[Devel] Re: [PATCH][for -mm] Fix and Enhancements for memory cgroup [1/6] fix refcnt race in charge/uncharge

2007-10-09 Thread Balbir Singh
KAMEZAWA Hiroyuki wrote: The logic of uncharging is - decrement refcnt - lock page cgroup - remove page cgroup. But the logic of charging is - lock page cgroup - increment refcnt - return. Then, one charge will be added to a page_cgroup under being removed. This makes no big trouble

[Devel] Re: [PATCH][for -mm] Fix and Enhancements for memory cgroup [1/6] fix refcnt race in charge/uncharge

2007-10-09 Thread YAMAMOTO Takashi
The logic of uncharging is - decrement refcnt - lock page cgroup - remove page cgroup. But the logic of charging is - lock page cgroup - increment refcnt - return. Then, one charge will be added to a page_cgroup under being removed. This makes no big trouble (like panic) but one charge

[Devel] Re: [PATCH][for -mm] Fix and Enhancements for memory cgroup [1/6] fix refcnt race in charge/uncharge

2007-10-09 Thread KAMEZAWA Hiroyuki
On Wed, 10 Oct 2007 07:31:38 +0900 (JST) [EMAIL PROTECTED] (YAMAMOTO Takashi) wrote: - atomic_inc(pc-ref_cnt); - goto done; + if (unlikely(!atomic_inc_not_zero(pc-ref_cnt))) { + /* this page is under being uncharge ? */ +