public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: balbir@linux.vnet.ibm.com
Cc: containers@lists.linux-foundation.org,
	YAMAMOTO Takashi <yamamoto@valinux.co.jp>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()
Date: Mon, 18 Feb 2008 15:14:25 +0800	[thread overview]
Message-ID: <47B93051.9020500@cn.fujitsu.com> (raw)
In-Reply-To: <47B92D47.2050008@linux.vnet.ibm.com>

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.

  reply	other threads:[~2008-02-18  7:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47B93051.9020500@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yamamoto@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox