LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
@ 2008-02-18  5:59 Li Zefan
  2008-02-18  6:14 ` Balbir Singh
  2008-02-18  6:39 ` [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() YAMAMOTO Takashi
  0 siblings, 2 replies; 11+ messages in thread
From: Li Zefan @ 2008-02-18  5:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Balbir Singh, KAMEZAWA Hiroyuki, LKML, containers

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
be VM_BUG_ON(page).

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6bded84..c2959ee 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -534,7 +534,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
+		VM_BUG_ON(!page);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
-- 
1.5.4.rc3


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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  5:59 [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() Li Zefan
@ 2008-02-18  6:14 ` Balbir Singh
  2008-02-18  6:22   ` YAMAMOTO Takashi
  2008-02-18  6:39 ` [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() YAMAMOTO Takashi
  1 sibling, 1 reply; 11+ messages in thread
From: Balbir Singh @ 2008-02-18  6:14 UTC (permalink / raw)
  To: Li Zefan; +Cc: Andrew Morton, containers, LKML

Li Zefan wrote:
> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
> be VM_BUG_ON(page).
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
why we can't bug on pc.



-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  6:22   ` YAMAMOTO Takashi
@ 2008-02-18  6:20     ` Balbir Singh
  2008-02-18  6:47       ` Li Zefan
  0 siblings, 1 reply; 11+ messages in thread
From: Balbir Singh @ 2008-02-18  6:20 UTC (permalink / raw)
  To: YAMAMOTO Takashi; +Cc: lizf, akpm, containers, linux-kernel

YAMAMOTO Takashi wrote:
>> Li Zefan wrote:
>>> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
>>> be VM_BUG_ON(page).
>>>
>>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
>>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>> pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
>> why we can't bug on pc.
> 
> pc is dereferenced before this VM_BUG_ON.
> 
> YAMAMOTO Takashi
> 

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  6:14 ` Balbir Singh
@ 2008-02-18  6:22   ` YAMAMOTO Takashi
  2008-02-18  6:20     ` Balbir Singh
  0 siblings, 1 reply; 11+ messages in thread
From: YAMAMOTO Takashi @ 2008-02-18  6:22 UTC (permalink / raw)
  To: balbir; +Cc: lizf, akpm, containers, linux-kernel

> Li Zefan wrote:
> > No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
> > be VM_BUG_ON(page).
> > 
> > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> > Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
> why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

> 
> 
> 
> -- 
> 	Warm Regards,
> 	Balbir Singh
> 	Linux Technology Center
> 	IBM, ISTL
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  5:59 [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() Li Zefan
  2008-02-18  6:14 ` Balbir Singh
@ 2008-02-18  6:39 ` YAMAMOTO Takashi
  1 sibling, 0 replies; 11+ messages in thread
From: YAMAMOTO Takashi @ 2008-02-18  6:39 UTC (permalink / raw)
  To: lizf; +Cc: akpm, containers, linux-kernel, balbir

> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
> be VM_BUG_ON(page).
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  mm/memcontrol.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 6bded84..c2959ee 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -534,7 +534,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
>  		if (scan >= nr_to_scan)
>  			break;
>  		page = pc->page;
> -		VM_BUG_ON(!pc);
> +		VM_BUG_ON(!page);

can't page be NULL here if mem_cgroup_uncharge clears pc->page behind us?
ie. bug.

YAMAMOTO Takashi

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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  6:20     ` Balbir Singh
@ 2008-02-18  6:47       ` Li Zefan
  2008-02-18  7:01         ` Balbir Singh
  0 siblings, 1 reply; 11+ messages in thread
From: Li Zefan @ 2008-02-18  6:47 UTC (permalink / raw)
  To: balbir; +Cc: YAMAMOTO Takashi, akpm, containers, linux-kernel

Balbir Singh wrote:
> YAMAMOTO Takashi wrote:
>>> Li Zefan wrote:
>>>> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
>>>> be VM_BUG_ON(page).
>>>>
>>>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
>>>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>> pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
>>> why we can't bug on pc.
>> pc is dereferenced before this VM_BUG_ON.
>>
>> YAMAMOTO Takashi
>>
> 
> OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.
> 

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().


#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))


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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  6:47       ` Li Zefan
@ 2008-02-18  7:01         ` Balbir Singh
  2008-02-18  7:14           ` Li Zefan
  2008-02-18  7:34           ` [PATCH] memcgroup: remove a useless VM_BUG_ON() Li Zefan
  0 siblings, 2 replies; 11+ messages in thread
From: Balbir Singh @ 2008-02-18  7:01 UTC (permalink / raw)
  To: Li Zefan; +Cc: containers, YAMAMOTO Takashi, akpm, linux-kernel

Li Zefan wrote:
> Balbir Singh wrote:
>> YAMAMOTO Takashi wrote:
>>>> Li Zefan wrote:
>>>>> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
>>>>> be VM_BUG_ON(page).
>>>>>
>>>>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
>>>>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>>> pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
>>>> why we can't bug on pc.
>>> pc is dereferenced before this VM_BUG_ON.
>>>
>>> YAMAMOTO Takashi
>>>
>> OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.
>>
> 
> No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().
> 
> 
> #define list_for_each_entry_safe_reverse(pos, n, head, member)		\
> 	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
> 		n = list_entry(pos->member.prev, typeof(*pos), member);	\
>                                ^^^^^^^^^^^
> 	     &pos->member != (head); 					\
>               ^^^^^^^^^^^
> 	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
> 

Hmm.. We used to have a for loop with !list_empty() as a termination condition
and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not
make sense.


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
  2008-02-18  7:01         ` Balbir Singh
@ 2008-02-18  7:14           ` Li Zefan
  2008-02-18  7:34           ` [PATCH] memcgroup: remove a useless VM_BUG_ON() Li Zefan
  1 sibling, 0 replies; 11+ messages in thread
From: Li Zefan @ 2008-02-18  7:14 UTC (permalink / raw)
  To: balbir; +Cc: containers, YAMAMOTO Takashi, akpm, linux-kernel

Balbir Singh wrote:
> Li Zefan wrote:
>> Balbir Singh wrote:
>>> YAMAMOTO Takashi wrote:
>>>>> Li Zefan wrote:
>>>>>> No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should
>>>>>> be VM_BUG_ON(page).
>>>>>>
>>>>>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
>>>>>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>>>> pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure
>>>>> why we can't bug on pc.
>>>> pc is dereferenced before this VM_BUG_ON.
>>>>
>>>> YAMAMOTO Takashi
>>>>
>>> OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.
>>>
>> No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().
>>
>>
>> #define list_for_each_entry_safe_reverse(pos, n, head, member)		\
>> 	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
>> 		n = list_entry(pos->member.prev, typeof(*pos), member);	\
>>                                ^^^^^^^^^^^
>> 	     &pos->member != (head); 					\
>>               ^^^^^^^^^^^
>> 	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
>>
> 
> Hmm.. We used to have a for loop with !list_empty() as a termination condition
> and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not
> make sense.
> 
> 

I see, and I'll post a new patch to just remove it.

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

* [PATCH] memcgroup: remove a useless VM_BUG_ON()
  2008-02-18  7:01         ` Balbir Singh
  2008-02-18  7:14           ` Li Zefan
@ 2008-02-18  7:34           ` Li Zefan
  2008-02-18  8:12             ` Balbir Singh
  2008-02-18  8:48             ` KAMEZAWA Hiroyuki
  1 sibling, 2 replies; 11+ messages in thread
From: Li Zefan @ 2008-02-18  7:34 UTC (permalink / raw)
  To: akpm; +Cc: balbir, containers, KAMEZAWA Hiroyuki, linux-kernel

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition
and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not
make sense.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 718acf8..631002d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
-- 
1.5.4.rc3

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

* Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()
  2008-02-18  7:34           ` [PATCH] memcgroup: remove a useless VM_BUG_ON() Li Zefan
@ 2008-02-18  8:12             ` Balbir Singh
  2008-02-18  8:48             ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 11+ messages in thread
From: Balbir Singh @ 2008-02-18  8:12 UTC (permalink / raw)
  To: Li Zefan; +Cc: akpm, containers, linux-kernel

Li Zefan wrote:
> Remove this VM_BUG_ON(), as Balbir stated:
> 
> We used to have a for loop with !list_empty() as a termination condition
> and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not
> make sense.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
>  mm/memcontrol.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 718acf8..631002d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
>  		if (scan >= nr_to_scan)
>  			break;
>  		page = pc->page;
> -		VM_BUG_ON(!pc);
> 
>  		if (unlikely(!PageLRU(page)))
>  			continue;

This seems much better

Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()
  2008-02-18  7:34           ` [PATCH] memcgroup: remove a useless VM_BUG_ON() Li Zefan
  2008-02-18  8:12             ` Balbir Singh
@ 2008-02-18  8:48             ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-02-18  8:48 UTC (permalink / raw)
  To: Li Zefan; +Cc: akpm, balbir, containers, linux-kernel

On Mon, 18 Feb 2008 15:34:48 +0800
Li Zefan <lizf@cn.fujitsu.com> wrote:

> Remove this VM_BUG_ON(), as Balbir stated:
> 
> We used to have a for loop with !list_empty() as a termination condition
> and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not
> make sense.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
>  mm/memcontrol.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 718acf8..631002d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
>  		if (scan >= nr_to_scan)
>  			break;
>  		page = pc->page;
> -		VM_BUG_ON(!pc);
>  
>  		if (unlikely(!PageLRU(page)))
>  			continue;
> -- 
> 1.5.4.rc3
> 
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Thanks,
-Kame


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

end of thread, other threads:[~2008-02-18  8:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-18  5:59 [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() Li Zefan
2008-02-18  6:14 ` Balbir Singh
2008-02-18  6:22   ` YAMAMOTO Takashi
2008-02-18  6:20     ` Balbir Singh
2008-02-18  6:47       ` Li Zefan
2008-02-18  7:01         ` Balbir Singh
2008-02-18  7:14           ` Li Zefan
2008-02-18  7:34           ` [PATCH] memcgroup: remove a useless VM_BUG_ON() Li Zefan
2008-02-18  8:12             ` Balbir Singh
2008-02-18  8:48             ` KAMEZAWA Hiroyuki
2008-02-18  6:39 ` [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON() YAMAMOTO Takashi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).