From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C9012E2850 for ; Mon, 15 Jun 2026 09:38:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781516325; cv=none; b=eJDt3ed8gPvszb1k2gsYS/8mHeTvmr3AkxmtifT1OLl1mVOAIosKOJlWNAIyeyowyWIEHvmM8F/RvG8O/Al4+LkXdYaTCUqA0NFmYf0txCc6oo4m94BpILHIjLJu+yAjZv4fjmQ5BBq7yDFj8icOmeK3NUYbPlHxo0bzHJ0jUY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781516325; c=relaxed/simple; bh=5W9S4pgDg4/wNgsNm7pUUV0vbqnLkdd/LqkUgfe2UH8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a5o3+PRpJDVxn9379LLFBT81ipG/Eq6IK4THm0kyNChbHgQWppYgyBJydRYe1BljZPdqShIC/aeNDGEuH6WXroOhdBXGGByimcpIp+sUHgwjlZ9ebgRtloWT9VUCW4J1V+wTu53E4tZBEO/QLb+6/kMzvbaaGNmsEumD/0uk9o4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=cMw1C28+; arc=none smtp.client-ip=209.85.219.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="cMw1C28+" Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-8ce9e56f68cso26178826d6.2 for ; Mon, 15 Jun 2026 02:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1781516323; x=1782121123; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oamN5hjWi+TCb5PPsVj9eSoiuDSUof3U7OYNH2/rvIc=; b=cMw1C28+9tJYOQ7hVT3DvNUY4YjCbCe2Ok9i4q/E05Sur6rmTz9O2dcb3COWbmXt/i a0vynKs0BbsB90oTaKZ8uvD1N8mde9+hkviXYyugr7IApL7yiNOadkidIRZoZ2Cm39uB 5JLaETSbJ+soFLeS1g9CNT6yAX4/6tbO/oskVDeWFOC6J6KEux9/yF3aNbSaXwF86rkh r8Xt49c87Hl1BEuRmhVsYwEs+kyN7FG3lnGUzTqqW73HeMKb9h5E91yzGvCw+OhwiCeo 1eo9t3zZC0Fd7dPA0Q8ARRYLPxbNitfRNOcr3ao143B8K2T+mqJpeGr5cOoH0w2Wc13s w/IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781516323; x=1782121123; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oamN5hjWi+TCb5PPsVj9eSoiuDSUof3U7OYNH2/rvIc=; b=QmT1gaKsxR5EyBk1wIJeSkTM0nY5EREPMDJ8GuCLeA3EYATIHguz5TT+nISPqaPqrb Opii6N7swPaKXEi1qc876ZITCZOsMkj3URVpMlqAdPF12dvr4k207aA4LQPcI6aN0ubs I38DjtNRff7jhKDaToNkjHiXA5nqFYVeeYOHkMBlhy/Eihd8qfAlKu2iYsEREM0KMEPA Bj+EBKmm4fC3SolRA6idC4G7ivpp7hCDF3xFuDlRd/tPn3htD0mYol8Vql6fYwblbdO2 TfmqkeZWYpKQnrv6WKxHn/v+EMjX78ghUEYHq8yQZAt/OkwIxpcwxBI3ZaO8vCOSrzBO nbhQ== X-Forwarded-Encrypted: i=1; AFNElJ9GmkO+EYmejgYDFAr34ABVrtceONLTXbTetUsbOtl8d6+3pbG5ZISdwvjQ21TWARN7r3Njxkhpm4//FUU=@vger.kernel.org X-Gm-Message-State: AOJu0YwVt9xNCdwY/2coUukCJP80NoiY7dZ8oPNVcq/17OFytPq0xWrs 33zDzAdfYoPaM4yOqEbGtvZl3E0C6Qc6AK6z6tqhcNBpOXV687NLJH0XPIgHXY0X9sE= X-Gm-Gg: Acq92OEUEAqiC3DwUspAAAmt+baHfR5Ld6Qj2LYu+7LX7vZmv1XRofXW0CpRptC235z 2PsDtkZc87zzN9QX+VDs0FC4o7XIjvdb2xb19lFxKv563VQ+XERlK8d95++yisa6Kf8lnbGlSw/ FhqSFm5fTkVuToCcmLI2OTNR3paBnnkq3/8w9bvDYauzds4igja4AWJ7ta8yaQxy9OtDHSN+9Tk 9qgDeRJqUC58l/GuCZ8bdRNREgm/xJ8ZPr1t0sC02XVG0jgDtE9SvaDu5oCEFCeBh4k7kjHPpbG m+aZZ92OohgNGjd5Tm7PBhiQcIvF2U/A8geIpqt6ikN7aqFGP9Kiu6bneAkfkPI65EYMNQWG6Y1 iUn1W2P9dAMmV0hCEv5W4nW4dpejHP5kQHFv04S0kXfMDeXgZGgWk5+wZYONardJCBV2P1Yoip0 +rHhKxOimExrzyP2UNV7bbheb23shB29Y6tvkRPCBxtQR4HwO5Ts6GHMudRpVWJ5nVlYg0fMwqh gTYQzeBvF4lqpM= X-Received: by 2002:a05:6214:5907:b0:8cb:e63e:2a45 with SMTP id 6a1803df08f44-8d32c4eb32emr217014056d6.18.1781516323361; Mon, 15 Jun 2026 02:38:43 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (158-94-182-130.mclarenap.oninferno.net. [158.94.182.130]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8d301c237e8sm108166456d6.17.2026.06.15.02.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 02:38:42 -0700 (PDT) Date: Mon, 15 Jun 2026 05:38:38 -0400 From: Gregory Price To: "David Hildenbrand (Arm)" Cc: Farhad Alemi , Andrew Morton , Waiman Long , Farhad Alemi , Yury Norov , Joshua Hahn , Zi Yan , Matthew Brost , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Rasmus Villemoes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed Message-ID: References: <8d3b4561-92cd-4ebc-8462-5fb0fd659e8a@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d3b4561-92cd-4ebc-8462-5fb0fd659e8a@kernel.org> On Mon, Jun 15, 2026 at 10:08:51AM +0200, David Hildenbrand (Arm) wrote: > On 6/14/26 15:25, Farhad Alemi wrote: > > > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > > --- a/kernel/cgroup/cpuset.c > > +++ b/kernel/cgroup/cpuset.c > > @@ -2649,7 +2649,7 @@ void cpuset_update_tasks_nodemask(struct cpuset *cs) > > > > migrate = is_memory_migrate(cs); > > > > - mpol_rebind_mm(mm, &cs->mems_allowed); > > + mpol_rebind_mm(mm, &cs->effective_mems); > > God this is confusing. > All interactions between mempolicy and cpuset are horrible and confusing. Much like Lorenzo's anon_vma work, I have to keep notes on how this whole thing doesn't just spew SIGBUS constantly. The short answer is: mempolicy is advisory and cpuset is strictly followed - in a dispute cpuset wins... except for file backed memory, then everyon loses and nothing is consistent. > Naturally I wonder: Why are we not using "task->mems_allowed" (maybe cs vs. tsk > was the original bug?), which is effectively just newmems? > Short answer: task->mems_allowed is protected by the task lock and we don't hold the task lock for a foreign task (not-current) over mm operations. Long answer: Reasons and "Stop looking at the spaghetti, it's going to break" ~Gregory