Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752946Ab0BVMM1 (ORCPT ); Mon, 22 Feb 2010 07:12:27 -0500 Received: from cantor2.suse.de ([195.135.220.15]:33304 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641Ab0BVMM0 (ORCPT ); Mon, 22 Feb 2010 07:12:26 -0500 Date: Mon, 22 Feb 2010 23:12:22 +1100 From: Nick Piggin To: David Rientjes Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Miao Xie , Lee Schermerhorn Subject: Re: [regression] cpuset,mm: update tasks' mems_allowed in time (58568d2) Message-ID: <20100222121222.GV9738@laptop> References: <20100218134921.GF9738@laptop> <20100219033126.GI9738@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1435 Lines: 33 On Fri, Feb 19, 2010 at 02:06:45AM -0800, David Rientjes wrote: > On Fri, 19 Feb 2010, Nick Piggin wrote: > > But it doesn't matter if stores are done under lock, if the loads are > > not. masks can be multiple words, so there isn't any ordering between > > reading half and old mask and half a new one that results in an invalid > > state. AFAIKS. > > > > It doesn't matter for MAX_NUMNODES > BITS_PER_LONG because > task->mems_alllowed only gets updated via cpuset_change_task_nodemask() > where the added nodes are set and then the removed nodes are cleared. The > side effect of this lockless access to task->mems_allowed means we may > have a small race between > > nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); > > and > > tsk->mems_allowed = *newmems; > > but the penalty is that we get an allocation on a removed node, which > isn't a big deal, especially since it was previously allowed. If you have a concurrent reader without any synchronisation, then what stops it from loading a word of the mask before stores to add the new nodes and then loading another word of the mask after the stores to remove the old nodes? (which can give an empty mask). -- 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/