Re: [PATCH 2/3] memcgroup: fix typo in VM_BUG_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
>>>>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>>>> 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
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux