Messages in this thread | | | Date | Sun, 7 Dec 2008 00:26:37 +0900 | From | "KOSAKI Motohiro" <> | Subject | Re: [PATCH] introduce get_mm_hiwater_xxx(), fix taskstats->hiwater_xxx accounting |
| |
Hi Oleg
> But the difference can be huge. Let's suppose the process has 2 threads > T1 and T2. > > T1 exits, calls update_hiwater_vm(), notices that mm->hiwater_vm must be > updated, and preempted right before mm->hiwater_vm = new_value. > > T2 does free(malloc(A_LOT)) and exits. It sets the correct value for > ->hiwater_vm which takes A_LOT into account and disappears. > > T1 resumes, and "reverts" ->hiwater_vm to the "new_value" which was > calculated before. > > Now, since T1 is the last exiting thread, the whole thread group > exits and we report the wrong ->hiwater_vm to the userspace. > > Yes, this race is unlikely. But there is another reason (perhaps > not very good) why I tried to remove update_hiwater_xxx() from > do_exit().
This explain is very good clarification than current patch description, IMHO. So, if possible, I hope to add it into the patch description.
thanks.
| |