From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 4D50030D3EC for ; Tue, 23 Jun 2026 16:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782231211; cv=none; b=sqTVvzgm6tWR0qpZibCQfFygEx37hfAURs3jkSsb73kmpOqHT0YuhuZHq4NDEUwobe8lMcePciaayn6AsWKyyqRMlTyABggG5aNGDg/S//n1Tsqiq+2YKd5nvc7INBUtI4eV9FA07frYuVYvfRfqeWEESXThtS/siKfonw3EYTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782231211; c=relaxed/simple; bh=rB6mVYXXDHOlR5uCYK3SgikrRY57JV1RdtOiSeVXDR4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KQqjP/IQc0nRpxp0ou022K44Uu/NWxLG2j07LJ87lL2oWjhE4q1ZGG6Z120/NJ0ZJNbELld2z3lmoaFwesMY1C3LLrXXRDG3ZrikbaEFZu3dHZPSsMOg6IfMutniD4KOOLWnkTWrdkViHfUSXNNepX29OV5xKFeOY41A9gPJ1mU= 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=J9zhV3lm; arc=none smtp.client-ip=209.85.219.47 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="J9zhV3lm" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-8de2adc59d8so316486d6.1 for ; Tue, 23 Jun 2026 09:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1782231208; x=1782836008; 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=1j3KoSBiivnqdcrOevh5ULZphp+5TbYQXFTFY6Ui8zY=; b=J9zhV3lmXoeU7nvc3MKhXdEpylvsr4u0hZ1uyZcscx3b7S8zJD3LjsAZnal+rcoCp9 +PL9CTvXQqjXYG1RqOHsgH4gG9JTOuyj3/5pWXaAwEY6iFwc/GRas7ihEruebIV5ryMd N1/ttXvvJbdyXxzOVyUWqQn1KqS855a0f6wqaVjeQhtPYJ+vHkm11Y9a5jiw15FLa/Zn a6c2JfsA4VNyKsvTi4Cuiqbvjt03DRfY0FAEkQ/znIQkXX05gDFYM8o00Lfy9HFkqeqx /3VgiWiRACScAPLfdAeQGr5WZzgx0ya8ScWxkLkyljfmSjPRSandNWVwWJBSenUXLVt8 WSFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782231208; x=1782836008; 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=1j3KoSBiivnqdcrOevh5ULZphp+5TbYQXFTFY6Ui8zY=; b=F/WZJCNNbtBD7gl2iYTNlsjv9HQSs8EEw1CdZv0ZIYnPG0BpKwHyUu0SBQB4gy9/HR 9BQB559dth0t0G7RULU/SQ/0w88T0si5D/+azftd7vndjz+1zXHQc9iecLL1qclUKqE9 RD2inHDhAABtIPdCeqpGUd/i+SMAAov2fkxHsm7XswR7WljXnKfi7iEuHheuhqzqEYRo Nxi1XpLZzEySAWzObD4orE4s9zPyknp1nX+GscCy70UF/dKccwDa6yVhNqRGYcCKXy5T TdjG9Pxgt4tMbe61t39TZ/FFKH0B8B1BzWqCeNxUG8/DQP/OvTdEyAbllcidVN6Oeski 8AMw== X-Forwarded-Encrypted: i=1; AHgh+Ro9T6ULRYmzh5q9KR8qDRSN9ipb4/iUpN919AIwCgFizDFiCUoiSZnnvZ0JQaJLJP/DemnGJv90GiTn9rU=@vger.kernel.org X-Gm-Message-State: AOJu0YyDM3YIML8GPlO9ttT3tttI5jOVP/GT28vrbtw+xm5ZIXGUWghq pJnujbPuneLLfuJO/1vrHDLVWBnJwb/BZykMMN60ZWoJzVtvAe3rmmLuGEf6QE0rpHtNZzX8H15 Q3xvK X-Gm-Gg: AfdE7cngbbv1PjVIhfLYhJh6u4nSgry9QW6nuvzdfOSeyrwOAfv6mvsS7Yvq4Z4CBCH 3PhvtSYM5k0CAg7zLNzbUJQ2H5fdHokDNyBEv2BVzWGk8nlbiYswVw6hMMq3wotpU2y296U4+xZ I1CWfMtFx6q2RiPs8g41ycPGQd4p6whZzrEJq/BsBkxg/luXw13Jo0iGG0WZyDkZ2OaRqTf0fYq V5YaJkeWyEkmXKz92iyt9BeNsIn2nlPFNQU5azRMpaku68V1T09KY4bYDyxaQgABIn6ktlSLHMo faFkQsMX0hhNiSYl4cEih0Z5YWBsqQO42YkfQl/mFE0Qexi38P2p7OlUCke93Vl8TJJ5B1Qtnt/ JXKNsKUuW4ARgClhQcmzbtu1el+/4suKFwQdyrcZBhpM0GXi4+hWskqjBceELJ8xww7LV3Ik6zT a4EtTNSiQR1ZY67P4kc9uco5pDL05WQsQISY3m4eqAI8uDz1dbA1GQYxSGW63nG2dj/QCs X-Received: by 2002:a05:6214:5144:b0:8d9:ceb7:3ae6 with SMTP id 6a1803df08f44-8e3b6e146dfmr50627616d6.15.1782231208098; Tue, 23 Jun 2026 09:13:28 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8df7f016d5esm127912366d6.10.2026.06.23.09.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2026 09:13:27 -0700 (PDT) Date: Tue, 23 Jun 2026 12:13:23 -0400 From: Gregory Price To: Waiman Long Cc: Ridong Chen , Tejun Heo , Johannes Weiner , Michal =?iso-8859-1?Q?Koutn=FD?= , Li Zefan , Farhad Alemi , Andrew Morton , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Tomlin , Guopeng Zhang , David Hildenbrand , stable@vger.kernel.org Subject: Re: [PATCH v7 1/9] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed Message-ID: References: <20260621032816.1806773-1-longman@redhat.com> <20260621032816.1806773-2-longman@redhat.com> 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: <20260621032816.1806773-2-longman@redhat.com> On Sat, Jun 20, 2026 at 11:28:08PM -0400, Waiman Long wrote: > From: Farhad Alemi > > Creating a child cpuset where cpuset.mems is never set leads to a div/0 > when a VMA mempolicy with MPOL_F_RELATIVE_NODES rebinds in response to a > CPU hotplug event. > > Reproduction steps: > 1) Create a cgroup w/ cpuset controls (do not set cpuset.mems) > 2) Move the task into the child cpuset > 3) Create a VMA mempolicy for that task with MPOL_F_RELATIVE_NODES > 4) unplug and hotplug a cpu > echo 0 > /sys/devices/system/cpu/cpu1/online > echo 1 > /sys/devices/system/cpu/cpu1/online > 5) mempolicy rebind does a div/0 in mpol_relative_nodemask on the > call to __nodes_fold() > > The cpuset code passes (cs->mems_allowed) which is not guaranteed to have > nodes to the rebind routine. Use cs->effective_mems instead, which is > guaranteed to have a non-empty nodemask. > > Closes: https://lore.kernel.org/linux-mm/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/ > Link: https://lore.kernel.org/all/CA+0ovCiEz6SP_sn3kN4Tb+_oC=eHMXy_Ffj=usV3wREdQrUtww@mail.gmail.com/ > Fixes: ae1c802382f7 ("cpuset: apply cs->effective_{cpus,mems}") > Suggested-by: Gregory Price > Suggested-by: Waiman Long > Signed-off-by: Farhad Alemi > Acked-by: Waiman Long > Cc: stable@vger.kernel.org Reviewed-by: Gregory Price > --- > kernel/cgroup/cpuset.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 591e3aa487fc..b21c31650583 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -2653,7 +2653,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); > if (migrate) > cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems); > else > -- > 2.54.0 >