From patchwork Thu Aug 1 23:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaiyang Zhao X-Patchwork-Id: 13750929 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 0E94AC3DA64 for ; Thu, 1 Aug 2024 23:26:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9668C6B0085; Thu, 1 Aug 2024 19:26:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 918876B0088; Thu, 1 Aug 2024 19:26:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DE4E6B0089; Thu, 1 Aug 2024 19:26:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5D5446B0085 for ; Thu, 1 Aug 2024 19:26:13 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0CFE916104C for ; Thu, 1 Aug 2024 23:26:13 +0000 (UTC) X-FDA: 82405262226.14.28160C8 Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) by imf06.hostedemail.com (Postfix) with ESMTP id 3DDFF18000F for ; Thu, 1 Aug 2024 23:26:11 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=cs.cmu.edu header.s=google-2021 header.b=iQAOqohz; spf=pass (imf06.hostedemail.com: domain of kaiyang2@andrew.cmu.edu designates 209.85.222.47 as permitted sender) smtp.mailfrom=kaiyang2@andrew.cmu.edu; dmarc=pass (policy=none) header.from=cs.cmu.edu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722554714; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hJR7bvI+iQjeQmGSpDi85+MJMEyNoLojT26U6ewve94=; b=LTwgQA3rN+yUcU6+k16tm4dlW89TFbEBbqv1MnI2hPNtUDLJOGBjjhAGyBYkJw2+xIM48t e73UQNEnQFqbqyTUYA3e+TBeurIHxCfYf/dPX7HglotZ7mDchaaVo72+30qDIDBgGwRDfD I2OvxlsMPfWmgU71ntBH2RerTVgOqI0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722554714; a=rsa-sha256; cv=none; b=MsB/L4AQzOOSwFulviSZa50TOHPBruV2mb8sLPNzuGCvfRqyZo/0Klv3d4P10FjfWgj/+4 hVf9caBfSpvw+nHKZ9Cv97V1ZdqHRCb97B6Z1LN5hUUm3a2HHdgsd8GdPvqA6iiuBAfJUT zAF7MQVc6xakMED8eLqMqZ/WHJXJw4k= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=cs.cmu.edu header.s=google-2021 header.b=iQAOqohz; spf=pass (imf06.hostedemail.com: domain of kaiyang2@andrew.cmu.edu designates 209.85.222.47 as permitted sender) smtp.mailfrom=kaiyang2@andrew.cmu.edu; dmarc=pass (policy=none) header.from=cs.cmu.edu Received: by mail-ua1-f47.google.com with SMTP id a1e0cc1a2514c-83172682ab3so2050884241.2 for ; Thu, 01 Aug 2024 16:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.cmu.edu; s=google-2021; t=1722554770; x=1723159570; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hJR7bvI+iQjeQmGSpDi85+MJMEyNoLojT26U6ewve94=; b=iQAOqohzY/9AFJodNpvvspywoNcC43rtg67Gbm+rYkmGDt8k54Bkf7qB2ZsZTYBv1y etc1TnGwDzuga9OyrWWu1TBGs7DTmjaRffJk9eYkZ9+ejow1x5ODqve1Ra5cZBJJsP4q NwQB51NBNpRoviAzrASNzBl9w/HPSun/4VYXPhwVwIdvA+NQ6y0zNEVxxWQEBF8d7wld gIOsFvKjZeIlwYElegV2Gc6C4d2rWjp/YDqi+kSrlkl0FVxBQ+0VtDbj+C53RVDhFKME zsDXpPbt7sX/6UxIyCTiSw7yNnytKaWWuryGK64j1CdJIGg2x1O1LH6iAt+MpM2bozbD DdiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722554770; x=1723159570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hJR7bvI+iQjeQmGSpDi85+MJMEyNoLojT26U6ewve94=; b=FgS2HImgcHHMFNE7+k9mYR8b6qIhD3Gx1zKu4SjUeHt5kPfRm3hufz/S7clLCl0Lzm 1k+6BeGTpLVQFtdw3bDX6XwwkflRsV+fQe3JkdSXrUrIWPXjFtNIrIDW9xHqWViSL1Zs F7fKRqoJCSpmunBESQar6N8D75q/Syz9RieCfntSWuq+zaoMi7wa2KRSWqxEbZ8wWj5S qwdi6JAxo2MuTRgUHx4o1FmWmFWaB7IpWZ0DiJH6gRAb0iBMjDr29RFf2tvhccr7WsEq I2Ck8HGAes3QmFdOzNWVEFkt2Ixv61O3UOXe4L5LldWlWRiKoIz0lDQtHbqUp+LgHTYV 0xqQ== X-Gm-Message-State: AOJu0YyyMGMxVOK7MkWAmxn30RzJo6mXygru5zsND+lbcwlNwTDcIv8Y LkSH57GC4oZujfS+D30RTB1ho91B9hTCl4IytzpHjpS7CaDPdad6cDAJn5yvfRk6oL87H0o8PZJ CrFXGd2kdmaqk+HWpkDgH5oVRB0NxiA/S4SovFmoboZDTM63vgYEXODUsh05VxTg4LRlPXgc5QX ypRwfZWa4Z5GvTJ3gyoGEWwWgoLLlff8nj X-Google-Smtp-Source: AGHT+IH0FZGVlqY4YgLRToCAVoRrKkNYf7BNU9Xqelw6iNnK4LeVOfQzMrcq2u8rPXkaR+WyDIFb5A== X-Received: by 2002:a05:6102:2ac1:b0:492:9ca1:d35e with SMTP id ada2fe7eead31-4945bdb01f4mr2838904137.5.1722554769925; Thu, 01 Aug 2024 16:26:09 -0700 (PDT) Received: from localhost (pool-74-98-231-160.pitbpa.fios.verizon.net. [74.98.231.160]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-6bb9c5dd76csm1606676d6.0.2024.08.01.16.26.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Aug 2024 16:26:09 -0700 (PDT) From: kaiyang2@cs.cmu.edu To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, Kaiyang Zhao Subject: [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites Date: Thu, 1 Aug 2024 23:25:47 +0000 Message-ID: <20240801232548.36604-2-kaiyang2@cs.cmu.edu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801232548.36604-1-kaiyang2@cs.cmu.edu> References: <20240801232548.36604-1-kaiyang2@cs.cmu.edu> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3DDFF18000F X-Stat-Signature: 1ii6k6kaebz7jmbyypjje5qpi4q5ffm7 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1722554771-493543 X-HE-Meta: U2FsdGVkX192267VuZNtbBiTs1AfTW0mYJsj+IYHIwUVV1p87SRjt41yUkH0FSJuV/lJ4fZ5C5bPbu8/O/6wXxmTlyhIZThOMo3BQ8j3YjFtowK7OuNStDdxViYH5HMzTGudz3pD0ry1qcbkaaZcDcAp7XmtML4nxmuqd1qy51tI/cUPrR0v13GHeAS7dZSPfrsi7tCMJCqF3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gxqno/obxZU3aKmRRBeIVzCysvCuvKR9quOFiYn0a9c3O6Nqmi7urj3P86G042WdH0A0/1+2ZVgWQhky5c10Pug5qhPVhXf5YefNDNfq80RWgZfNqg6ZlywQntqMQPQy X-Bogosity: Ham, tests=bogofilter, spamicity=0.018884, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kaiyang Zhao Define promo_wmark_pages and convert current call sites of wmark_pages with fixed WMARK_PROMO to using it instead. Signed-off-by: Kaiyang Zhao Signed-off-by: Andrew Morton Acked-by: Johannes Weiner --- include/linux/mmzone.h | 1 + kernel/sched/fair.c | 2 +- mm/vmscan.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9f389c76581f..6ea22b3e2f30 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -671,6 +671,7 @@ enum zone_watermarks { #define min_wmark_pages(z) (z->_watermark[WMARK_MIN] + z->watermark_boost) #define low_wmark_pages(z) (z->_watermark[WMARK_LOW] + z->watermark_boost) #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) +#define promo_wmark_pages(z) (z->_watermark[WMARK_PROMO] + z->watermark_boost) #define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost) /* diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 416e29b56cc4..20ea6d085305 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1742,7 +1742,7 @@ static bool pgdat_free_space_enough(struct pglist_data *pgdat) continue; if (zone_watermark_ok(zone, 0, - wmark_pages(zone, WMARK_PROMO) + enough_wmark, + promo_wmark_pages(zone) + enough_wmark, ZONE_MOVABLE, 0)) return true; } diff --git a/mm/vmscan.c b/mm/vmscan.c index c89d0551655e..31d13462571e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6705,7 +6705,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx) continue; if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) - mark = wmark_pages(zone, WMARK_PROMO); + mark = promo_wmark_pages(zone); else mark = high_wmark_pages(zone); if (zone_watermark_ok_safe(zone, order, mark, highest_zoneidx))