linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix build warning and avoid checking for mem != null twice
@ 2009-05-26 13:14 Nikanth Karthikesan
  2009-05-26 13:19 ` Pekka Enberg
  2009-05-26 13:30 ` Balbir Singh
  0 siblings, 2 replies; 4+ messages in thread
From: Nikanth Karthikesan @ 2009-05-26 13:14 UTC (permalink / raw)
  To: Balbir Singh; +Cc: Pavel Emelyanov, KAMEZAWA Hiroyuki, linux-mm, linux-kernel

Fix build warning, "mem_cgroup_is_obsolete defined but not used" when
CONFIG_DEBUG_VM is not set. Also avoid checking for !mem twice.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

---
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 01c2d8f..420fc61 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -314,14 +314,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
 	return mem;
 }
 
-static bool mem_cgroup_is_obsolete(struct mem_cgroup *mem)
-{
-	if (!mem)
-		return true;
-	return css_is_removed(&mem->css);
-}
-
-
 /*
  * Call callback function against all cgroup under hierarchy tree.
  */
@@ -932,7 +924,7 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
 	if (unlikely(!mem))
 		return 0;
 
-	VM_BUG_ON(!mem || mem_cgroup_is_obsolete(mem));
+	VM_BUG_ON(!mem || css_is_removed(&mem->css));
 
 	while (1) {
 		int ret;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix build warning and avoid checking for mem != null twice
  2009-05-26 13:14 [PATCH] Fix build warning and avoid checking for mem != null twice Nikanth Karthikesan
@ 2009-05-26 13:19 ` Pekka Enberg
  2009-05-26 13:30 ` Balbir Singh
  1 sibling, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2009-05-26 13:19 UTC (permalink / raw)
  To: Nikanth Karthikesan
  Cc: Balbir Singh, Pavel Emelyanov, KAMEZAWA Hiroyuki, linux-mm,
	linux-kernel, Andrew Morton

On Tue, May 26, 2009 at 4:14 PM, Nikanth Karthikesan <knikanth@suse.de> wrote:
> Fix build warning, "mem_cgroup_is_obsolete defined but not used" when
> CONFIG_DEBUG_VM is not set. Also avoid checking for !mem twice.
>
> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

I also sent a patch to fix this but yours is much nicer.

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

>
> ---
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 01c2d8f..420fc61 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -314,14 +314,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
>        return mem;
>  }
>
> -static bool mem_cgroup_is_obsolete(struct mem_cgroup *mem)
> -{
> -       if (!mem)
> -               return true;
> -       return css_is_removed(&mem->css);
> -}
> -
> -
>  /*
>  * Call callback function against all cgroup under hierarchy tree.
>  */
> @@ -932,7 +924,7 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
>        if (unlikely(!mem))
>                return 0;
>
> -       VM_BUG_ON(!mem || mem_cgroup_is_obsolete(mem));
> +       VM_BUG_ON(!mem || css_is_removed(&mem->css));
>
>        while (1) {
>                int ret;
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix build warning and avoid checking for mem != null twice
  2009-05-26 13:14 [PATCH] Fix build warning and avoid checking for mem != null twice Nikanth Karthikesan
  2009-05-26 13:19 ` Pekka Enberg
@ 2009-05-26 13:30 ` Balbir Singh
  2009-05-26 14:32   ` Nikanth Karthikesan
  1 sibling, 1 reply; 4+ messages in thread
From: Balbir Singh @ 2009-05-26 13:30 UTC (permalink / raw)
  To: Nikanth Karthikesan
  Cc: Pavel Emelyanov, KAMEZAWA Hiroyuki, linux-mm, linux-kernel

* Nikanth Karthikesan <knikanth@suse.de> [2009-05-26 18:44:32]:

> Fix build warning, "mem_cgroup_is_obsolete defined but not used" when
> CONFIG_DEBUG_VM is not set. Also avoid checking for !mem twice.
> 
> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

I thought we fixed this, could you check the latest mmotm please!
-- 
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix build warning and avoid checking for mem != null twice
  2009-05-26 13:30 ` Balbir Singh
@ 2009-05-26 14:32   ` Nikanth Karthikesan
  0 siblings, 0 replies; 4+ messages in thread
From: Nikanth Karthikesan @ 2009-05-26 14:32 UTC (permalink / raw)
  To: balbir
  Cc: Pavel Emelyanov, KAMEZAWA Hiroyuki, linux-mm, linux-kernel, Pekka Enberg

On Tuesday 26 May 2009 19:00:50 Balbir Singh wrote:
> * Nikanth Karthikesan <knikanth@suse.de> [2009-05-26 18:44:32]:
> > Fix build warning, "mem_cgroup_is_obsolete defined but not used" when
> > CONFIG_DEBUG_VM is not set. Also avoid checking for !mem twice.
> >
> > Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
>
> I thought we fixed this, could you check the latest mmotm please!

I am unable to find this in mmotm. Also the !mem check can be avoided even in
the VM_BUG_ON as we check for it just before that. If it is not fixed already,
please take this else ignore.

Thanks
Nikanth

Fix build warning, "mem_cgroup_is_obsolete defined but not used" when
CONFIG_DEBUG_VM is not set. Also avoid checking for !mem again and again.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 01c2d8f..d253846 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -314,14 +314,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
 	return mem;
 }
 
-static bool mem_cgroup_is_obsolete(struct mem_cgroup *mem)
-{
-	if (!mem)
-		return true;
-	return css_is_removed(&mem->css);
-}
-
-
 /*
  * Call callback function against all cgroup under hierarchy tree.
  */
@@ -932,7 +924,7 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
 	if (unlikely(!mem))
 		return 0;
 
-	VM_BUG_ON(!mem || mem_cgroup_is_obsolete(mem));
+	VM_BUG_ON(css_is_removed(&mem->css));
 
 	while (1) {
 		int ret;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-26 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-26 13:14 [PATCH] Fix build warning and avoid checking for mem != null twice Nikanth Karthikesan
2009-05-26 13:19 ` Pekka Enberg
2009-05-26 13:30 ` Balbir Singh
2009-05-26 14:32   ` Nikanth Karthikesan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox