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 9075FC54E41 for ; Tue, 5 Mar 2024 09:00:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD2D26B009F; Tue, 5 Mar 2024 03:59:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B83116B00A0; Tue, 5 Mar 2024 03:59:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FD5D6B00A1; Tue, 5 Mar 2024 03:59:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8DBA86B009F for ; Tue, 5 Mar 2024 03:59:50 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5E33940B45 for ; Tue, 5 Mar 2024 08:59:50 +0000 (UTC) X-FDA: 81862387740.03.0ACBEF1 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf10.hostedemail.com (Postfix) with ESMTP id 9B30EC0011 for ; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="E/xocz8E"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629188; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=4ZCDtc/dJgHDt3Q9eIEZQ2h5DfnThe3skNrOJaIq/vulPeJaIqCJYXaN5MboOt1YpB51YE d7dOIpGBri8Furhzsm5dhODAbtm3IwqxDUGTgDnu4jKTwcS7Mi/CEH7HHgXcvH8/h9Azk5 mosQsa3JONZI1nT2XIzMbZYxhucspwM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="E/xocz8E"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629188; a=rsa-sha256; cv=none; b=sRFwFtuw9JyUSEytNFGaALROGUZpODvOImEi889ftTruuJ0NtkHyBVkQGWZEBAN65KaeXq vfVhAVX+PZBmmS3VCB79pqIB7dqyHMnkJb37YBHWVIGSZ1yepbghRWNICYpBqnSPVnBWRV crLr2yDNZYlPek08dul77BOXRNGIySY= Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5658082d2c4so7403411a12.1 for ; Tue, 05 Mar 2024 00:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629187; x=1710233987; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=E/xocz8EadQxpDPMx8HAzQvRIrDCfliOvtMp3JKYBX1srz+WeKwfjW90J/BaIMKdPF 3lKGC0N5hUlU1qtT1owG52S3M+DnONu8JgcoHBBzLVzTBg2gkgAe6A7PcAm4a7gAFmCK +jlLUXBqGx6QVMUpl1EV20TtLb0Hjm/cjkJdWUfelAtKhACtvEpkLZuXBMmBwv/TT9EG 5WI/LjlbST8wjluxBfAJGUHn+MLh8tg/jtOMFZykTYdakD4n66dwi6YJa8OQiXitqpeK IAH+OL9Oke9HwP6AlxbP6E+kjH+KklUCsqOSlnB2Wyj6LLbjcZbke1JtNSZLHKrCoT4C SeyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629187; x=1710233987; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=B5MOe1V06Rtu5WtR5y5Al4t2V3LleerPxtAu6n25FcGgPco0Hfe9mSHit4faqtOl8B dpaxi7+YZ1M7xsHhnKaHLskChaaFA1dmmWF2M3j+prU1LgueTICfaayoYNAQm9NotkQ7 O18Cwn+MYdO+0WkrlMQ2Yb1eiJipKxQweNoeMNSv/iTWrYSpokXlbPvawiVFJSdp0n3+ XptgBBzF2zRxT/HPvVG1O/IqU3flVEzUCDbNAYmQ4ygggiyOOCEnlgwIyrSac7e+Nrta RIJd2Qmstv/LWbxRQEtiPiI2n/W8YwtFke/WpZLnvgwCz7LPxrm5Olo71sCxLf9cY3uH 1abA== X-Forwarded-Encrypted: i=1; AJvYcCWi0kOGYV0OYBXQSd2pc10eUb5KrMbsDp/h9BwxelQMWKWB4fVssY/8FqlNjSvtbi81i1EMQSJQ9oKBDSJZelQBjWE= X-Gm-Message-State: AOJu0YzdGgq3dYhVJndifHFSX/2y7WIZSKX2kMAK171jW3CuJ9fhgPki GyeLZWQeOQOVeUNQRawfRBmJnvdXvDKMyPHLCukR8pBQEc5QHPNPm5/DddjX+bw= X-Google-Smtp-Source: AGHT+IH5rQymVzDyRd5/kVEF3MMnB3QjDXj4i4rk7c4yzXXCC29AJ9nQ021BYHQfLPW889VaZHI1rw== X-Received: by 2002:a17:906:d114:b0:a45:ac31:4bde with SMTP id b20-20020a170906d11400b00a45ac314bdemr450647ejz.29.1709629187311; Tue, 05 Mar 2024 00:59:47 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:45 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 5 Mar 2024 09:59:16 +0100 Message-Id: <20240305085919.1601395-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9B30EC0011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: csezdjbxwm9raxbs6crahi5j5ioroxut X-HE-Tag: 1709629188-774406 X-HE-Meta: U2FsdGVkX18cRyizyLa5cRk5pzgW5hxhWGDSkg9ALy/lhJjyAmGGmNxkUGz8U2mkKPSWYhmcrOOc1fPHm9c1ROaVXD7k/EumtjkEvF1kuOkSCQ+rV5H34g7masU4oRo+vpsC9n86x4iczxEfoaghGMPeCt4J+goHqZg4WnrVfh7R6NRpgM5Xuk7SMdFxsbjRoiuXE3F6mgJPuydPJ+LHhPjcS4XDR59gDp59C11bxX1fhI0Losl3DTgxxsvMMUhrim2OJ99IG0pbvEV3hmXyQKztG8Z4nNFUKArPcJFanDDPD7oxPi5yltNPa2RG78iaI70cxc2CZxTgz8E8Ck/uOsUsW1D/DbDFM5ze6bRiandPibVWZSDsVmEELyfESRHk0Lbj3X7nRqhSxRTaK9upZRP2Q/tpd9/IT1ZOFjeo6Guz4EKUEvt5bWNLSY0l3QaGrilKH+EubsHf0BMoYHdL1fNUz0RtqdDsA9AUbBCAgVpAv7pZtIZr/BV/44JOKvO1YZABrcf8mZhIej13T8ZUQfF9Tv+96YpOXgFcuR2LNy6RqctMpYuLZWyP9Q5mtleR4pIl6y+a+BMrgobR2/hSLa8oNXZ/YXUasNsEkGxBfAhKOkGMQ2StJTvE2e9HGamGGSK1W0QGh8/LX+Xb2RqWrVa+Bi0r6iN8+B23OivgihYCLev2eTfmWfBryWFr1W49v7dJB4/PD/ivUQWC7/X6kpE1eopJ4qyPg2IG2WyuIGuMGCZ8Wq0UmySqsrWopsKTSECeVO5w6W3C9Gtr41Z1PedX4D9zYvxWgIiYCxIk+werBc6ZtIqYrf1OQtTkM2ucVFvn3b3l1LpLbUBJ5G4AhpErGXoOobrgIhaHwj06Nj/0D1uz6u8/E4/SPiiEHGuA/bckXMsg/A67jjZfpizzLytqSBZyr0PZPQKwxKiyvHhuGhlrQ6iGdxUHDJY584Ne95LzOik5V4l0Z+GqZ7/ fCeSyEAS vWEjbMdyCk/lEMvyW4iR35l4xZ7WBbREh6zUsbsBl+h9HzRvFySbEU0boTJ0Y81L0piuJkh/sYJ1nfvj+/3kajIN7TgCb+H6Qf3TT0IKZtwaPm1sg9yxN1BtIqw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000890, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 45 +----------------------------- include/linux/mm/pfmemalloc.h | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 include/linux/mm/pfmemalloc.h diff --git a/include/linux/mm.h b/include/linux/mm.h index b3f83fb26aca..07262ae43c5d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1763,50 +1764,6 @@ static inline pgoff_t page_index(struct page *page) return page->index; } -/* - * Return true only if the page has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool page_is_pfmemalloc(const struct page *page) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)page->lru.next & BIT(1); -} - -/* - * Return true only if the folio has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool folio_is_pfmemalloc(const struct folio *folio) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)folio->lru.next & BIT(1); -} - -/* - * Only to be called by the page allocator on a freshly allocated - * page. - */ -static inline void set_page_pfmemalloc(struct page *page) -{ - page->lru.next = (void *)BIT(1); -} - -static inline void clear_page_pfmemalloc(struct page *page) -{ - page->lru.next = NULL; -} - /* * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. */ diff --git a/include/linux/mm/pfmemalloc.h b/include/linux/mm/pfmemalloc.h new file mode 100644 index 000000000000..345b215a3566 --- /dev/null +++ b/include/linux/mm/pfmemalloc.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PFMEMALLOC_H +#define _LINUX_MM_PFMEMALLOC_H + +#include // for BIT() +#include // for struct page + +/* + * Return true only if the page has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool page_is_pfmemalloc(const struct page *page) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)page->lru.next & BIT(1); +} + +/* + * Return true only if the folio has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool folio_is_pfmemalloc(const struct folio *folio) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)folio->lru.next & BIT(1); +} + +/* + * Only to be called by the page allocator on a freshly allocated + * page. + */ +static inline void set_page_pfmemalloc(struct page *page) +{ + page->lru.next = (void *)BIT(1); +} + +static inline void clear_page_pfmemalloc(struct page *page) +{ + page->lru.next = NULL; +} + +#endif /* _LINUX_MM_PFMEMALLOC_H */ -- 2.39.2