Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758152AbYLFP0s (ORCPT ); Sat, 6 Dec 2008 10:26:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756914AbYLFP0j (ORCPT ); Sat, 6 Dec 2008 10:26:39 -0500 Received: from wa-out-1112.google.com ([209.85.146.180]:32928 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756865AbYLFP0i (ORCPT ); Sat, 6 Dec 2008 10:26:38 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=f/XucHUw6rsMrWJicVA/Z0HeWYJb3DV7MOGghgK1ywCU6xlc7pYsCAiNXRlnEiHai1 pJlfTD5mgJPtptLhPah7M1uW5cSQ8EI3gqm0/9crxih4dlaSxQjm8CoAbiGpcTCcRp6a jNwSlK3x3xgB8Q5FOHg49XL6kWcAbYSyRcBZw= Message-ID: <2f11576a0812060726m141e1dd0rd2890c2fe3fd5484@mail.gmail.com> Date: Sun, 7 Dec 2008 00:26:37 +0900 From: "KOSAKI Motohiro" To: "Oleg Nesterov" Subject: Re: [PATCH] introduce get_mm_hiwater_xxx(), fix taskstats->hiwater_xxx accounting Cc: "Hugh Dickins" , "Andrew Morton" , "Balbir Singh" , "Jay Lan" , "Jiri Pirko" , linux-kernel@vger.kernel.org In-Reply-To: <20081204135250.GA5448@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081203181220.GA22918@redhat.com> <20081204135250.GA5448@redhat.com> X-Google-Sender-Auth: f5f37364acd3ff16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 30 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/