From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9D2F2F872 for ; Fri, 26 Dec 2025 19:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766777552; cv=none; b=qsC2p05iYCeRWa4+EE/Sz5X56j7tWLv+EwRulzjyAI+ob+Lt5Za0GbpsibTR9ysieF+Kft2EzZBsL0PPMBIO9ofxUImkmW5ayGTQHxfWuDHaqzWZ8jcTHgYSkTSj0fSZHbXQheiT3Tc85EAu9I/AX1SRsCtqPGsiAcVNA1Sg9Pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766777552; c=relaxed/simple; bh=jS4EkTImd1IJh3YoXH3P2OAG4BDSYQtaA20XlD+QvDo=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=O1qpaL9l7oJCiIANfRqptdH7d5wk62wtsA66BkJmj79C8IzLA/pJ7j0FGQitAnbkavv/wxOgVnAVoHP1jNkFQE2dUv06+25Z8y2tllrEEd+P4FFoi0zh9VxFjrlO73G9fLyAJ/Lc1UoRPSXikrH6KoR+UIUtsUO6Kw6MblSSaNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HkSIdv8p; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=c1DPIBYP; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HkSIdv8p"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="c1DPIBYP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766777549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=exrylgbBHUfG9Ezs8wURYm14g4G1+zNQOsDbopt4dSY=; b=HkSIdv8psDYeOrf0yHah85u2hYYs07OCBaRHFptsiNfTjzQprqtrF+0mD6+zgiIFjyXhbG FScD8I7m973kDXQHq4AmmrHilDFyXibVHobwDzNdCfBW3JZRNR/SGI8BGsMLlnE0fFM7oC Y/jkCBxoAeLH92w0x/CNOEoWpnVSaII= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-CEGXuw9LNLu6D9U6oSqwBQ-1; Fri, 26 Dec 2025 14:32:28 -0500 X-MC-Unique: CEGXuw9LNLu6D9U6oSqwBQ-1 X-Mimecast-MFC-AGG-ID: CEGXuw9LNLu6D9U6oSqwBQ_1766777548 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4ee1b7293e7so266224851cf.0 for ; Fri, 26 Dec 2025 11:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766777547; x=1767382347; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=exrylgbBHUfG9Ezs8wURYm14g4G1+zNQOsDbopt4dSY=; b=c1DPIBYPTo0xLvU2D5DMcG5fZcZycUTltveAPHEkRAbsRoZ2TWQDw+r7T8UbLlxmmw tvN05FBf/hRzV4GKgGMAnCV5ubNCddM8fF2eGqsbdGtU40xNuJjoBVhzgPJA744Uc5o9 8vEJNvnUAi4DlEdRXn8RtCRO9vInH3BCmWyNcRBQUKmlb7F/VQff1B0ZnadqFcAkOexZ IWBW/7eIY1ZL3S+zfAWf3t/x11dUfsgA3xUn+n4gwn1Z+ncasvNe8ao4qmLDvlbcT7d7 PWK40yM/E223Cn1WOmeenVCjGvjcEzvrSgv5cPPPLsIzdDg35VStmASTVoq1chJQbk76 iuCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766777547; x=1767382347; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=exrylgbBHUfG9Ezs8wURYm14g4G1+zNQOsDbopt4dSY=; b=IPKKdN+vzF6v4kpm9pgzSSKjiO4zJjsRdWer2bgr4llI0re7pz0Ya9MmgUBC8tlQIG T8L7mD2O5ulDlUHBdeKK+G7J549x+/peo6oEhXSfQltvKvvOw6f1HYm/O13DT9SG2TUc T/5k1LhCqA26g49O0NzPW2AyPmHICxe4XxKkFgU1kpHymIu8goPZK+fBr94zwqjCR6zo kE+wb0oJS5ThK78gapSDixJrCCNez7VSw7F0Df1KQ/9iNg3IFh1jnhgFKXGKHGQK9tDa tpj+42Swohy4OIPQZ00z2gExcpvepCHxzTIZdaI3EWyWkQ349FYU/tevjyl7Ybb6KAS9 T0ZA== X-Gm-Message-State: AOJu0Yxsaxp7T5MgTVusPdIryihw7E7iD2kwWjKTMHnhtmYECWxwFUI4 UzwcgD1xfCPSPFbaleagRnojjokVb4RA9jpOkbfWw7L4mvkuG7BgI+e2BJO9PPWPK8V/RA1wrH9 AYlozdfR3sKQ3KhMYrNHZln96gKtvYP4mNRaFAA4viM9srQtTx3Yuin+pL/W5yMDnK0DEcZRTGg == X-Gm-Gg: AY/fxX7KH2ypxL1gGHIyogJgtseSXvWIeZCEggzoXwahk5E+97yUxXycoAHT7xBstmT kacT0amv8st35SFPDY0Ao6d8A0xSKn2d0vdOxOvhky9seGjYyOHC8DL6qqe8TQCWkgLakhNgyQf /gRy0+eDGypw3XDdtRxUsVRnQq0MpeHRPX95QA51BptAVMlaEcq99BqevKtAeGetN9YSV5l2UEQ FSzpRG0dHmQsodwz59i3aZLFYRHBQRzgVHpIP60BARe5kHzO+3li6ftMuSMfnIl2dnkHmSk9tTL lpuk66ivwdjmwbJc8QOT7Lva2qGyx8kTtWkA554BAcZbdii2bBN9zPec/THIJPONuAJxipLJgiO cp8tU8RfprtnzCtQ5iKsGf2mOylnG2SL8u5IYfIB+WAVE/U3T0VwNu9we X-Received: by 2002:ac8:7f92:0:b0:4ee:24e8:c9ae with SMTP id d75a77b69052e-4f4abd80862mr370555341cf.53.1766777547177; Fri, 26 Dec 2025 11:32:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrrgKjEllT+0HCpBK+Top+NtVALAkZu7cvx+lq0ZkwXiENCiRd2VvX3Yv+fGt1maICEZ/q4g== X-Received: by 2002:ac8:7f92:0:b0:4ee:24e8:c9ae with SMTP id d75a77b69052e-4f4abd80862mr370555061cf.53.1766777546776; Fri, 26 Dec 2025 11:32:26 -0800 (PST) Received: from ?IPV6:2601:600:947f:f020:85dc:d2b2:c5ee:e3c4? ([2601:600:947f:f020:85dc:d2b2:c5ee:e3c4]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-88d997aeff4sm186021866d6.29.2025.12.26.11.32.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Dec 2025 11:32:26 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <24a480ec-c7b3-4e0d-9895-f9c2ad88dc47@redhat.com> Date: Fri, 26 Dec 2025 14:32:23 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] mm/vmscan: fix demotion targets checks in reclaim/demotion To: Bing Jiao , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, gourry@gourry.net, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, tj@kernel.org, mkoutny@suse.com, david@kernel.org, zhengqi.arch@bytedance.com, lorenzo.stoakes@oracle.com, axelrasmussen@google.com, chenridong@huaweicloud.com, yuanchu@google.com, weixugc@google.com, cgroups@vger.kernel.org References: <20251221233635.3761887-1-bingjiao@google.com> <20251223212032.665731-1-bingjiao@google.com> Content-Language: en-US In-Reply-To: <20251223212032.665731-1-bingjiao@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/23/25 4:19 PM, Bing Jiao wrote: > Fix two bugs in demote_folio_list() and can_demote() due to incorrect > demotion target checks in reclaim/demotion. > > Commit 7d709f49babc ("vmscan,cgroup: apply mems_effective to reclaim") > introduces the cpuset.mems_effective check and applies it to > can_demote(). However: > > 1. It does not apply this check in demote_folio_list(), which leads > to situations where pages are demoted to nodes that are > explicitly excluded from the task's cpuset.mems. > > 2. It checks only the nodes in the immediate next demotion hierarchy > and does not check all allowed demotion targets in can_demote(). > This can cause pages to never be demoted if the nodes in the next > demotion hierarchy are not set in mems_effective. > > These bugs break resource isolation provided by cpuset.mems. > This is visible from userspace because pages can either fail to be > demoted entirely or are demoted to nodes that are not allowed > in multi-tier memory systems. > > To address these bugs, update cpuset_node_allowed() and > mem_cgroup_node_allowed() to return effective_mems, allowing directly > logic-and operation against demotion targets. Also update can_demote() > and demote_folio_list() accordingly. > > Reproduct Bug 1: "Reproduct" is not an English word. Use either "Reproduce" or "Reproduction". Cheers, Longman