From patchwork Tue Apr 2 20:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13614571 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 A15E9CD1292 for ; Tue, 2 Apr 2024 20:13:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A296F6B0089; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D90D6B0092; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8864F6B0089; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6C4136B0089 for ; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 33E03140447 for ; Tue, 2 Apr 2024 20:12:59 +0000 (UTC) X-FDA: 81965690478.02.6125ADD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id 9D35B180017 for ; Tue, 2 Apr 2024 20:12:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJw40H3t; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712088777; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QwLgf2EYj+juUDGhuHAn9rfAj5hC3bzzsJxsabP0fBQ=; b=qEPMg1e5m9l+dxGXPbY8J1gPymmSFBKV7AI6AIWYUrbodOKamGDrJmy/PCJ5fB33cdMw9W R2byzsQqYT+TFQT6ZWrLIuhGx+BQEYuIxUxSIYAVZ6VSJvnp1c2pf7q+w42iBZ+aEToEzE 10YgnYw8EEcKCWPT4ntJDznqyS2wDA4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJw40H3t; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712088777; a=rsa-sha256; cv=none; b=J/ZIPoN9gEA+HMU3PM8D3ItOdHbOnr6IwTlzwdqX7KXqyVU0atTeiZBHDQX5KTGjYlzxuI pKMQk2HuhdEatO/awWW6f/j1JGFQabZFOMddY+MvoqFvmpCq3YHK97tyHTWo1xEmN5EVol PSROh16Hf92Tp43IoKjyZWTN8TpEP8Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=QwLgf2EYj+juUDGhuHAn9rfAj5hC3bzzsJxsabP0fBQ=; b=dJw40H3tN3hNRovf1r8NCLPJ2f eB16leQKR+jHC7/IoLHhW8S3puuGssGFOJxDOsA6f3E5A6GtSj8egTzso2O/M0Xmh/hr6vRvV7udp bAtsgOq9wAbnenEbFp5pRxE7d2C/ou5scvJuy24Aat1E3iEppZG4Ptwg8e68I/naY6AWMdHYZIPxz mtgnvJBxqrN9DB/pjTGkEGqMs3F+/A+oY2hj5vatkdlXTKB63UatHsoJgCGGaCyEeE3YYkOEreHM8 W0Ge/vmkJMT9p5k/ZvLgg8O0n3+30FuX1j4wWe45QxZ09zYCklVkNGHR91z5Ldw2pAc/LQLRAC5po E/l9FeMg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrkV5-00000003qeM-3Y1u; Tue, 02 Apr 2024 20:12:55 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/4] mm: Generate PAGE_IDLE_FLAG definitions Date: Tue, 2 Apr 2024 21:12:51 +0100 Message-ID: <20240402201252.917342-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402201252.917342-1-willy@infradead.org> References: <20240402201252.917342-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: woneozmbp7qzggjxefg4oae4prrkuznh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9D35B180017 X-HE-Tag: 1712088777-846453 X-HE-Meta: U2FsdGVkX18f9nLWmmSo3Plo+svbo7tgpZfM9IrAs2FkqChWR5wRqyjC9iopKeAcl6e1EzJEfe7e3V5VhrIe6N/T+Bj7Z8NaJQT1/dI3HS/GQwxIpayt07MWlupbhWFDF8wT9JaAAVuUnszhz5xZNkF3VqzNP9x0D6yghSR4utUVQWIfxCbvsp3s9lF4tShIfCINsUmcHuQ+ogLa3qU9M4mjo7JGFVr8a4PZ2ywtkFNkgz/xKgbKs14IzNzLGxc997shPeBenZMMjJ5Gj63DaAyIgQFDTLilrKoDRl82YCm3WeeBboFfVPcJwTA2keru6Q5O8DdxY8AvwG4xIK44Iu2ics/zM3gSpwk7UVk8V9pgoYqb/j6PoNEb/2mPXsq1DAh2QgIm6GedieTLPQu7GSE1MnVbvToXbzzCbWCUpumS3JLzf/RIh30nq07E69fp7SM2oJd20G72BQ11ox5wsPMGvNt55ezeXWMyjjxyVws+RBGmFgyY56QPkkRdHJGeEzIOtR2uC26HliZOgTU8u+Q6XlLBjhqVnZgAVtEZwJf/967nLoqN5kPT2lN30P5af36AavV0Pq76n9ZNsZ0urKdbeVO/DUz+FE8DGU+GWrpgMzVg9VmLOpYopZP+Q8/MYI70zsz8PHi2VnPSitlfp739v41Pt7MHcEqy+XJUT5peUOMoD7Ez3J1Y7Q1BuUw2qOoVnweyohII60PaZ+QU6hgUFZCGPuHqWx2ql7rxrF43KPhJwsrGnW2HpcDnlIL02OVqFDJ0D0w1e9z6yuEV8S3BaWMt8pqbnTDHaLE175MzbGkTazAj2A375oFbHPlj8ftNwiV1RUmpYr3SbOd88d0Z5XM33MfFFU8ejXhaOYc3ibhAE2PJ0C5JHlqE3K1+iQsBeLbRSQeN5ENtYpn7YJSq6B7C23Mi2LaJDkMa9SmOl4kup3oqrl1zkQhkojAI4gedUkc6yB6T3PhFEPn iBzwp6iy xpBKd5B6riDB2iin5Y6jUqr16sfpV6d2Sfbo0qDgiZivgo0OmCRqO5de+JedjBhdbH2lF783rpFU16AB6asz13PRbPiJl3s68lyvWHg8NP3OAJh4qlECIHowCzvx45WhmIUhcJ/0hqY+yVcDeyVdpvi+vWkSFF1+1SPykGj62WeLCvPTylmslDEyrNWhL6/zL49NsAs8W+tIOmYjWvbzhrNmaz7DGaZgpMXV0 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: If CONFIG_PAGE_IDLE_FLAG is not set, we can use FOLIO_FLAG_FALSE() to generate these definitions. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 9 ++++++++- include/linux/page_idle.h | 37 ++----------------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 888353c209c0..a49739a67005 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -626,12 +626,19 @@ PAGEFLAG_FALSE(HWPoison, hwpoison) #define __PG_HWPOISON 0 #endif -#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT) +#ifdef CONFIG_PAGE_IDLE_FLAG +#ifdef CONFIG_64BIT FOLIO_TEST_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_SET_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_TEST_CLEAR_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_FLAG(idle, FOLIO_HEAD_PAGE) #endif +/* See page_idle.h for !64BIT workaround */ +#else /* !CONFIG_PAGE_IDLE_FLAG */ +FOLIO_FLAG_FALSE(young) +FOLIO_TEST_CLEAR_FLAG_FALSE(young) +FOLIO_FLAG_FALSE(idle) +#endif /* * PageReported() is used to track reported free pages within the Buddy diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index 6357f1e7918a..89ca0d5dc1e7 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -6,9 +6,7 @@ #include #include -#ifdef CONFIG_PAGE_IDLE_FLAG - -#ifndef CONFIG_64BIT +#if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT) /* * If there is not enough space to store Idle and Young bits in page flags, use * page ext flags instead. @@ -87,36 +85,5 @@ static inline void folio_clear_idle(struct folio *folio) clear_bit(PAGE_EXT_IDLE, &page_ext->flags); page_ext_put(page_ext); } -#endif /* !CONFIG_64BIT */ - -#else /* !CONFIG_PAGE_IDLE_FLAG */ - -static inline bool folio_test_young(const struct folio *folio) -{ - return false; -} - -static inline void folio_set_young(struct folio *folio) -{ -} - -static inline bool folio_test_clear_young(struct folio *folio) -{ - return false; -} - -static inline bool folio_test_idle(const struct folio *folio) -{ - return false; -} - -static inline void folio_set_idle(struct folio *folio) -{ -} - -static inline void folio_clear_idle(struct folio *folio) -{ -} - -#endif /* CONFIG_PAGE_IDLE_FLAG */ +#endif /* CONFIG_PAGE_IDLE_FLAG && !64BIT */ #endif /* _LINUX_MM_PAGE_IDLE_H */