From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85E23C369AB for ; Mon, 21 Apr 2025 23:58:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14DB36B0005; Mon, 21 Apr 2025 19:58:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D4C46B0007; Mon, 21 Apr 2025 19:58:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8F496B0008; Mon, 21 Apr 2025 19:58:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C9B296B0005 for ; Mon, 21 Apr 2025 19:58:49 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E39359531 for ; Mon, 21 Apr 2025 23:58:50 +0000 (UTC) X-FDA: 83359718820.09.97CE892 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf07.hostedemail.com (Postfix) with ESMTP id 3BCF040005 for ; Mon, 21 Apr 2025 23:58:48 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=ZLU+uA2+; dmarc=none; spf=pass (imf07.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.173 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745279928; a=rsa-sha256; cv=none; b=l1yEb+sUEhfk9fcc35IW4LZfZrW41oh+EmRFq56s5Z0FIfPawuoWOFnvwphWKfChMjSMJr 6HLEjtmQRj0/kWmMQ1Ib1f0PObulTKNfvVhfDVNcdZiQUmJJqO52gspvs8tDvP48fa2mVt s5bLFQ+ZVUD8T6e7aGUj/NChh+q7TVQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=ZLU+uA2+; dmarc=none; spf=pass (imf07.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.173 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745279928; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Pt9oqc8GpIrrFJN7eyvDbfp/Y6mGw45gh826BWQtRsM=; b=IkPG/D/VM/Wy29M5tJTCtrWQv9hyULUqR5ADhRZKc+lPC8dMn/UbO0C43KHm7U2E6397pT 5LObyEfNT1LMBjhAkhwrQofAPjbMJ4Pitt/xgv3QvN3+C5sG9VOfquYQ0cLnIYCJOYCItA VvJFitdRBkJqT7anKuSyoz1s/A7Q2BU= Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-47692b9d059so67721651cf.3 for ; Mon, 21 Apr 2025 16:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1745279927; x=1745884727; darn=kvack.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=Pt9oqc8GpIrrFJN7eyvDbfp/Y6mGw45gh826BWQtRsM=; b=ZLU+uA2+VQcpKAnhLJoXn1qRMSBBzvFTC17Vr80Z21pNpidcg6HpO3IElCwzOHHJ7C HK00qqJXLtszoE9Bn7ckrQXNZXG1S45MCkK8Ay+WXvN+MuGVxroPgrH5CNMNbb03s1xE /ERSVRKSHQ+ACvqDeymShfv+ufFqhFCdTspZ97YLIH4S0bFmKQNnyeg2JMNUPgUO8iG4 oPvQ72xHn0b2PafnqkyagRXCkKznmJJNzZX1Ht7vatmg4+WX4vYOxlzyI/FqW2bzeemx YVURJhvTMYpFJDg/0Wpt2+itzzA1bA/+hCJG9C99lvWmzUwVdnk9i9f7jmEeUbO14SCW xZ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745279927; x=1745884727; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Pt9oqc8GpIrrFJN7eyvDbfp/Y6mGw45gh826BWQtRsM=; b=AYafxmhkONOvm/M2VVXfGYWyff6XRVaI7XTU8/eJyb9wVWT61uxsJA66sCN4nwN64X C8tVWBhMJoZVXz8TI15HUuR/jXn9KiK/ZCSzcnVWUOTbsl+40M63Nz1aIyuVePuUDy1r vDrOsszxHpNaGWTeJLRuScsQjPM+WYpHLO1+FBKv29z9nvP3619weVMIQfwiQbL3W61Y rRJ+zFxzIEMLV8ngqEOXfqKSpaxWyvBWt2KQjax5RS11R1PN757E2DUwORir191u48mi N8F13jhUkgP4Ip38ofVFSkn+04B1WUl6tYPkmfgnrDCN+hdS4OqbLd2TKnrgQoAIw+Ku rmww== X-Forwarded-Encrypted: i=1; AJvYcCUwC4lVWLDUW41z6gTfou5anxz7oKaEYoj0be/r72Ef3j2KmC+Y0QBuJYpx+h2IbnG3tMTn4fo20Q==@kvack.org X-Gm-Message-State: AOJu0YxcYEUUvOheCAA/sSYUKgGNKURNdItLwr0irnSVrxhvWzQpXIWm eC7iarEp2sZLQKMxAHuWUzc1IxtcLuX6pws2zxOm7UNJ81997cxKot9wqcJeRh8= X-Gm-Gg: ASbGncvHEpxSQLfyrsXEL+8J3GrXoxMs3+rDJQKvu4OMP4QHJVXaw9W9i1U3MGDvEn7 HggVx5kJkNCP8NYQDdsmrsLyuf+4tg0DXeL/esTFb83/vi8OywisKfcMlOho/cnvgINt/VD9FBb jW59HoS9WcOrQGXfE0jXNGoSe1zZC9qViK0VJC5Qv4x12o9t/n2OBEDJDruo2QMK/l9wSTTd1zn 5xA/lSLl6LItR64G3KALmW8tKiCvKRAIhBUefD7gMzAlGTpfY94iCq7O4VSxfDSGMD14t3sNlaE H/g2hGOaqwdkY9vXeGbNYset0OUAkOaRPS3uAflbACwHQAGQmDpyz9/3UsQAhdDGfX9j4gvzQoq it4ceol+suj0I5LM7xChO/2g= X-Google-Smtp-Source: AGHT+IHyw2Ep7wGNuJcJaK9OYDj8tPnDiyNi+wpNnGzryaafEwPJbTCS6g9qpNwxguuCPeJgVM9iKQ== X-Received: by 2002:ac8:5916:0:b0:477:1ee1:23d9 with SMTP id d75a77b69052e-47aec3a7331mr260243311cf.20.1745279927250; Mon, 21 Apr 2025 16:58:47 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-47ae9851b8esm48411951cf.0.2025.04.21.16.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 16:58:46 -0700 (PDT) Date: Mon, 21 Apr 2025 19:58:44 -0400 From: Gregory Price To: Shakeel Butt Cc: Waiman Long , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, muchun.song@linux.dev, tj@kernel.org, mkoutny@suse.com, akpm@linux-foundation.org Subject: Re: [PATCH v3 2/2] vmscan,cgroup: apply mems_effective to reclaim Message-ID: References: <20250419053824.1601470-1-gourry@gourry.net> <20250419053824.1601470-3-gourry@gourry.net> <7dtp6v5evpz5sdevwrexhwcdtl5enczssvuepkib2oiaexk3oo@ranij7pskrhe> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam03 X-Rspamd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zrdQCaxx31GDQmcmntlCto/fSdZ/3o3jqo4eEkTpZRqDs9q3+bSvZ0bmifpM6WAUIvnrIKuomi1N1UlWWM1jNTkfgny00scKFHjk7Ov+Mh6h7dyC1WRs/zZ/f8eHcU/b4C8Gfz+5JyN8w3CKDjl0ddI4iJgUBclFKSN/HydERUtkYbHaIJiG4RNJ74GcUxENcwD36LkMmZO+YXJQrG/Jo2q5PbpPkIclEZ15KwRihGA+2gGayS54p7KhznfYl0efOv+xyP3vrZjmjbL6KwNj2CyS85PCKL41V3+T8s/dDCisFnKSxJOAn7Ia81yvJv5I9AqvBjYK1J7J1znVaAz2x4BTLwFAUU0JuN3NTN955FQ7REbiMen14odBAuf82nZ3HuB X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Apr 21, 2025 at 04:15:49PM -0700, Shakeel Butt wrote: > On Mon, Apr 21, 2025 at 06:59:20PM -0400, Gregory Price wrote: > > On Mon, Apr 21, 2025 at 10:39:58AM -0700, Shakeel Butt wrote: > > > On Sat, Apr 19, 2025 at 08:14:29PM -0400, Waiman Long wrote: > > > > > > > > On 4/19/25 2:48 PM, Shakeel Butt wrote: > > > > > On Sat, Apr 19, 2025 at 01:38:24AM -0400, Gregory Price wrote: > > > > > > +bool cpuset_node_allowed(struct cgroup *cgroup, int nid) > > > > > > +{ > > > > > > + struct cgroup_subsys_state *css; > > > > > > + unsigned long flags; > > > > > > + struct cpuset *cs; > > > > > > + bool allowed; > > > > > > + > > > > > > + css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys); > > > > > > + if (!css) > > > > > > + return true; > > > > > > + > > > > > > + cs = container_of(css, struct cpuset, css); > > > > > > + spin_lock_irqsave(&callback_lock, flags); > > > > > Do we really need callback_lock here? We are not modifying and I am > > > > > wondering if simple rcu read lock is enough here (similar to > > > > > update_nodemasks_hier() where parent's effective_mems is accessed within > > > > > rcu read lock). > > > > > > > > The callback_lock is required to ensure the stability of the effective_mems > > > > which may be in the process of being changed if not taken. > > > > > > Stability in what sense? effective_mems will not get freed under us > > > here or is there a chance for corrupted read here? node_isset() and > > > nodes_empty() seems atomic. What's the worst that can happen without > > > callback_lock? > > > > Fairly sure nodes_empty is not atomic, it's a bitmap search. > > For bitmaps smaller than 64 bits, it seems atomic and MAX_NUMNODES seems > smaller than 64 in all the archs. Unfortunately, it's config-defined on (NODES_SHIFT) and the max is 1024. Is there an argument here for ignoring v1 and just doing the bit-check without the lock? Is there an easy ifdef way for us to just return true if it's v1? ~Gregory