From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 071D52E8DFC for ; Thu, 11 Jun 2026 13:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781186263; cv=none; b=WZXkjznoS1AAP6Jz7EiTmPGZFHfwlVZNvl/PJqJPSA7rlvxDnHzX/Hq1qJ4iyZPUgYOVwauzHxbHtCdwJeO4VXntcDT3KJnKHSE9VWyzI+93JrPU+ZTyfbZAIIpjeGNcjgxlHUXWaViPeCfxe5gZ/Sw7gKXpWuagZUWJYQTR7O4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781186263; c=relaxed/simple; bh=BU/d6UozSW8Kaa0IHlLbbka/ZCxA27BnQBC7Cn/ajPI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OiBuCNjB4bVFD8y1jbzOtAcArWdDDNKrwvKGB9QpIkph4FEA3F21kdsDUzKjFinzliAKuSdXZKj252OEkcMqdUU997I+EAQVC68AW9oqjk4f18KBk1YZMWZqefKV/Cuy6OEZj8GeORUAc+ntcP7wj1+R2vbdbRG7iZEgGlbDIR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=DY4m5oVE; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="DY4m5oVE" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-490a7629453so6959225e9.0 for ; Thu, 11 Jun 2026 06:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781186260; x=1781791060; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ELiU8L1X2MD/8T2htcnXW//tl1+DcLq0oF7UnsGSTfA=; b=DY4m5oVEMcUzOih5g1tyKBWqHQXfcsxWyeS/9LjAQHghMYjeI2UsTT+62YTQ7uA+3m odEPvJVwstBbvI/8n2AA5ZIFDphL7/7rkoBnoI135OG6qRHQwuPbLvTQMXAZLWhMDvyr GA12RI9yBTcLhvQXSnE31E34QRFSpxYelVgxEq8SOrnCcKCsaKfkbig0kbEI+Eg1yhoC hS0MbBeJOg7XHjrr5S6eA7zPulWVZOz3npmxntH7cVhojcQKah7TaC4ycyshJpXPPF6Z tfkO98CQSDen48946jqGUHEMnAJxqNpTGkX1l+bo+lwIPmKRwH324SsI6qPgqiouW1ht 4Yuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781186260; x=1781791060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ELiU8L1X2MD/8T2htcnXW//tl1+DcLq0oF7UnsGSTfA=; b=kOW2LDMP2KX7VDM/1VAt4roFIfouEQdqlK4MXFngfvbdC5gwiAH4pcUunvE26TVDtj 0ZMFJqWUPOdnIE2KXdSduoQklsJBvGk2kCHsus+EuUNFyZCo3rl0NLq8uXBDG5gSQWZu O7r2IlB5YbGKmXm+TlouTwdlP6Gz7EwNjHaW4SLz+BFBPrWo3ASivSGEQtQNn25LxQOm dXhVhoFCM7bntCKU8PGE90je5XHT9jSEIyq+792VfN4Qmykdpk4NEu72io2jcxyw5AJ0 SGvbIjf4kJ0WzLOnVOtBhspBSDAniiApCRcV4LrKcrUJWHprhuaq2OUa62ppgjtxXlCQ qQSQ== X-Forwarded-Encrypted: i=1; AFNElJ+PsERuouFSDHIEsL2qDZXm7aOzUMytOC7PpBe6bnp319iBWdtYIKr08+NL8sEQOfAsMV6XLXvvHNU/ex8=@vger.kernel.org X-Gm-Message-State: AOJu0YxX3ISJfYIyNgM+HY/WwK8sdwBqWpFYJZEbw87T6QnzGF8GBUNU VTbS+KzQCiF104rCfRfIiMp5JWI5eKcU8mG66BMXuyWzj3iUZd9HQ7AG4SWqFYSXIQw= X-Gm-Gg: Acq92OEySHH5AfNMvK5XqjGXpaVOOWdMUY6xX2+7OwaOjZURBGw5gXRfil4XFF4vVYQ S5wGA4p8CFVIfHK4J4CMY5t0rj2ZtkRJMJLv6Y1/W8+W04Xe8coDPqg0jP8FgvouSFfZO0su8NA 8HSYYHalsDPVzhc89fFD49iErUV4URx/vfPVdujAo/4KA9Htx98OnHa8c7Z9pmkYAUohUQ283Ht DktkAO03AYjJYzWtS+nOiKDX7n+CERVtAP7U/CNaY3ug2S3Vc7hHMGs3nidWloXTVXwH7uRrdzx t4Ovjn8QSQiYLGGMkxaT6fmKERzRzogeJRhJe1yegwSx1Z3pOi1kdoY86d1REAH8hxI9ikNSaSp gJxyhX+U8WjTrFSWWwkWGeEg6VYxLsTRoxAC+YIatwCXZV3FRG5rN1Mmn6Yw38dUtJV/FWF8KHZ vcfDhsEZYlP2nUBy5XvtBxBaj2+niTPIn+L86PAJeDHZJ9+Hu1JIFCPdZruGd5LBRjlrIEEGUUj 9eH6kVvfjcsS9j+rypc6gVaIXo= X-Received: by 2002:a7b:c04b:0:b0:490:b71f:2eb with SMTP id 5b1f17b1804b1-490e5612c5dmr13380695e9.7.1781186260306; Thu, 11 Jun 2026 06:57:40 -0700 (PDT) Received: from mordecai (dynamic-2a00-1028-83b8-1e7a-3010-3bd6-8521-caf1.ipv6.o2.cz. [2a00:1028:83b8:1e7a:3010:3bd6:8521:caf1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490e2c907ddsm67156685e9.6.2026.06.11.06.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 06:57:39 -0700 (PDT) Date: Thu, 11 Jun 2026 15:57:36 +0200 From: Petr Tesarik To: "Brendan Jackman" Cc: "Andrew Morton" , "David Hildenbrand" , "Lorenzo Stoakes" , "Liam R. Howlett" , "Vlastimil Babka" , "Mike Rapoport" , "Suren Baghdasaryan" , "Michal Hocko" , , "Brendan Jackman" , "Johannes Weiner" , "Zi Yan" , Subject: Re: [PATCH 1/1] mm: remove NODE_RECLAIM_xxx macros Message-ID: <20260611155736.72613cf5@mordecai> In-Reply-To: References: <20260611124501.1465806-1-ptesarik@suse.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-suse-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 11 Jun 2026 13:32:04 +0000 "Brendan Jackman" wrote: > On Thu Jun 11, 2026 at 12:45 PM UTC, Petr Tesarik wrote: > > Change node_reclaim() to return a bool indicating whether any > > pages have been reclaimed, because that's the only information > > needed by the only caller, get_page_from_freelist(). > > > > Originally, I wanted to convert the preprocessor macros to an > > enum, but I couldn't find any explicit use of NODE_RECLAIM_SOME > > and NODE_RECLAIM_SUCCESS. That's because they are typecast from > > a bool. > > I'm slightly confused by the "typecast from a bool" thing - nr_reclaim > returns nr_reclaimed and then node_reclaim()'s caller gets that value > directly - is that what you're referring to? My fault. Without my patch, the return value is calculated as follows: ret = __node_reclaim(pgdat, gfp_mask, nr_pages, &sc) >= nr_pages The result type of a relational operator is an int, not a bool; and since I'm introducing a bool type elsewhere, no wonder you are confused. I can improve the commit message in a v2 if necessay. > > This seemed a bit fragile, > > .. Which, yeah, is awkward, thanks for fixing it. No problem. Petr T > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > index 3f3ff25e561ac..64f6b649eeac1 100644 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -7786,9 +7786,9 @@ static unsigned long __node_reclaim(struct > > pglist_data *pgdat, gfp_t gfp_mask, return sc->nr_reclaimed; > > } > > > > -int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, > > unsigned int order) +bool node_reclaim(struct pglist_data *pgdat, > > gfp_t gfp_mask, unsigned int order) > > I really dislike returning bools with no obvious polarity. Personally > I would keep NODE_RECLAIM_*, (optionally convert to an enum), move the > comments to the definition of the NODE_RECLAIM_ thingies instead of > get_page_from_freelist(), and fix node_reclaim() to return > NODE_RECLAIM_{SUCCESS,SOME} expliticly. > > I realise this philosophy is not favourable to concision though, I > won't die on that hill but could we at least get a comment on > node_reclaim()'s defintion... > > > > - ret = node_reclaim(zone->zone_pgdat, > > gfp_mask, order); > > - switch (ret) { > > - case NODE_RECLAIM_NOSCAN: > > - /* did not scan */ > > - continue; > > - case NODE_RECLAIM_FULL: > > - /* scanned but unreclaimable */ > > + if (!node_reclaim(zone->zone_pgdat, > > gfp_mask, order)) continue; > > - default: > > - /* did we reclaim enough */ > > - if (zone_watermark_ok(zone, order, > > mark, > > - ac->highest_zoneidx, > > alloc_flags)) > > - goto try_this_zone; > > > > + /* did we reclaim enough */ > > + if (!zone_watermark_ok(zone, order, mark, > > + > > ac->highest_zoneidx, alloc_flags)) continue; > > - } > > } > > ... or keep the intermediate variable and do: > > bool reclaimed_some = node_reclaim(...): > > Since then the variable name at least tells you what you're looking at > without needing to jump into the function implementation.