From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 5240639DBD0 for ; Sun, 14 Jun 2026 13:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.128.173 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781443559; cv=pass; b=vEzuD43rQ611n2VDK8jZeNiOzN35x3blhXJYllDMWHM6NueKMQoFTXpb5wAqL1q+ONFOmEA2nJyJEciew7B0B93Yjb5Y+nRoXuYPK5dpbtaocuwv7qjjtjPK5X9Ay2dSR1/K/MyVxctNOSs3pyyDMhZV9KH28VS10tD13e/uHgA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781443559; c=relaxed/simple; bh=8a8z9o8uhQwn072Nwdwrsu8F50f0ae0l8EpJfnSe8Zs=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=V7CkWP2FOX6zFRqPoyQ00ytbT7ubZPl50jwlAsDSXRGwgLVGkGgtbV0d+X2rAkGvYyJD0e7RrAr2zAuymPqRxAw7HolzhL9w/CVv2qxLL+FDkzAs9sWCNYMZnOoAOcp/vxJYgABrYcTz51UcWdSqg1gtgMqOBTPUPD+bSO6fcUQ= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=berkeley.edu; spf=pass smtp.mailfrom=berkeley.edu; dkim=pass (2048-bit key) header.d=berkeley.edu header.i=@berkeley.edu header.b=s3ZdgQ0j; arc=pass smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=berkeley.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=berkeley.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=berkeley.edu header.i=@berkeley.edu header.b="s3ZdgQ0j" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-7e266714bd3so26630357b3.2 for ; Sun, 14 Jun 2026 06:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781443557; cv=none; d=google.com; s=arc-20240605; b=EWkDaQq13P1emQEkt3bJaIZvK5MfKHz08KcSvSEXwrCxB2ghg0Cuj02y1CdoFAAeLX attseeMghJp6eTrktABL50IiWSn8d2gu4DBU4iamIdvs261wXEpOOevDtXeBRiTjKIK9 t7tFU+Jbui2dSgWjNRSgCeG/Y8ldzJOzyH/Hhs0F7JR+TPtV471h9TDNAh4sFEMHKX6H KCZKDNfyzKE5w/8+QJ5qSe5tROE0oC/ZqM7Pq1bQph95BwHafMw+ffnQq7Yy8dfGk0++ TihLzU5OyJhwNGzqf6iHWQhraMtmeyjv2c0iXcP4tg53WirQtHIqy7GGZ0gF4kOya1dJ Glbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:dkim-signature; bh=my7WznhvuaINq07i0eln+93EnzFiKa95Z+VUna30ulc=; fh=YtWlqlENvI8OHlHcWQsPNZTuVcZj84suT+vghKStK94=; b=kKM0V0fGhSPwMeAW9IvcPYxuARW1IbETWnA2w9CyFW46WbomDdVFhX+NyKtxHr/0sL klNBk8uZWEXEv/iYtMujU3Mcu8ivFbNJEo6aecNtSzh5d+LFkzn6YiOewvUhmc6+dylv JO2+XaFYlPJtxau6kAwA7stbuMVaXWJpLqtlvTLmn6YngIImJdNIFiIxLsD+pcH4a+e7 Z0L0TTpSz6rJhlgYJXOWtA9qOKvQvcvUBNi5tE1VJO5x+FZroK1rItgt7P2VX24J9CeP r0oUCCQ1CUC+GN9H521nTwIvWadEgqcgW4AfI3YiZfL+AS03olCFbtdciycRYWk/1rLA gynA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=berkeley.edu; s=google; t=1781443557; x=1782048357; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=my7WznhvuaINq07i0eln+93EnzFiKa95Z+VUna30ulc=; b=s3ZdgQ0j6wdDyJK+1d22+jBZLt2LhR2Mi8jqPQ3z/isAwctf3ViXA56e3N8khKKhww vmnVZeVAW1wDeL+KZtU2URDcwHYxTdvDKj7dQAg2rIz9I+oy4ubfKlsNI32QZ+LDw4Oe qW7GQAFqe+cJvP/0VHfPgrO58FSi8UglgtTFX9H9cSpSqkzpIwpgD4WzFLBDKHVkuTAe bKPdX19pyf2uEXOILG62k3EUQwNZ+3JbH4EA72HLdrw6dba8fYV0Vaemkuy56hwM0oWI FG1mbyrtkMB8CbtPKlmsvp7y845jcXXgqpVuTaB9qMLiIVdu5T9KBNz8Tat5V81a9/KG LwOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781443557; x=1782048357; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=my7WznhvuaINq07i0eln+93EnzFiKa95Z+VUna30ulc=; b=cmRcpNsmZk3uT0TceD/Vqsglngxm0Tr/ugvl1rV+/+8nwDz/lJcgDLmp+vLLUonsxX nZ1Co2pylPSX/+5SUnti9SJ8MePNQ4vTgG76wvlqUfJpvHMqXOXRXM1pjrcQF73Z1w7F TIcyomiMkLKeWKoKa7IK2fCJgv9o9xo4jAXA0IsdfMbLyAEtZQEMKMwif9VBuAYmYzPV bxqKLTBX08A2bBYc+XMebPmkHXsKdPUxphGzu+A+GRJTUF44Su4ojPyLEEsZFDq8x9qe 8Dx2J3zyLcMFv7/QIO8Xv004KwjvmMwsAmdP375kUzYQt4Ki8UZUevdvCtzCCRxTQbPD da6w== X-Forwarded-Encrypted: i=1; AFNElJ8LjApsf77AOeE5cwmOV56e2/pvkBN4PlHlB0f2j3Jo/nFh0XRdwEOd86t0j+Kcs/S/w19iwwNMHiPcb30=@vger.kernel.org X-Gm-Message-State: AOJu0YxuIZG065JBKT1GJM4H4seYiE78X4ECScHL6eClETyJoMpvvW9N PwOV3s3tTp5bf8aRJp7RnqtxvYnoAc3GnYEXfICnj3hzu5ODGlvXSNRBUoz7wVpWeF9zsBtSQ91 BvlHl4cEMoDjUb3dCGhERjaE+G7UfTmd3fu2w6eki X-Gm-Gg: Acq92OG6z4r6mPI2eaEqNP5H3N9N3AObAXvlpY32scETTg7UWcZIWY/c0cu1KvxuhKH /3CpurrNC7kR9ZzYWedlvN0VXbHyHfmPV/J+sLbq1qhd2SBzX7j1fRg0bi0C0a85Ea+7wYvfIZ7 HWZC/vQfblaQeR8wrOeVLoDtSHRg+G6qzfqAEu9LHixVPQYpK7OLl8f8JposvlQXtsFo5Kn/thy JBAXJVhnteeeHAmBqHUkbcxJK+7q0F0BkkxqUyYbE6p+1V9It6l36G4CHjsD0FWwbtXvZkQK/DK HJ8mQVixQw== X-Received: by 2002:a05:690c:3745:b0:7e2:a956:4083 with SMTP id 00721157ae682-7f8c1f15742mr70603597b3.20.1781443555816; Sun, 14 Jun 2026 06:25:55 -0700 (PDT) Received: from 474444807712 named unknown by gmailapi.google.com with HTTPREST; Sun, 14 Jun 2026 06:25:55 -0700 Received: from 474444807712 named unknown by gmailapi.google.com with HTTPREST; Sun, 14 Jun 2026 06:25:55 -0700 From: Farhad Alemi X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Sun, 14 Jun 2026 06:25:55 -0700 X-Gm-Features: AVVi8CdOyddTc0VCwydJ03Yt1oOOOGpiCzbsY_HpVqvtkDz1Xj3Bl7yujHIBV_M Message-ID: Subject: [PATCH v2] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed To: Andrew Morton , Waiman Long Cc: Farhad Alemi , David Hildenbrand , Gregory Price , 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 Content-Type: text/plain; charset="UTF-8" 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. Link: 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 Cc: stable@vger.kernel.org --- v2: rebind to cs->effective_mems instead of newmems (Waiman Long); condense the changelog. kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); if (migrate) cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems); else -- 2.43.0