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 D03BAC4345F for ; Tue, 30 Apr 2024 15:30:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4506A6B00A4; Tue, 30 Apr 2024 11:30:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DB006B00A6; Tue, 30 Apr 2024 11:30:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DD2E6B00A7; Tue, 30 Apr 2024 11:30:00 -0400 (EDT) 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 E83736B00A4 for ; Tue, 30 Apr 2024 11:29:59 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9BF76140861 for ; Tue, 30 Apr 2024 15:29:59 +0000 (UTC) X-FDA: 82066583718.07.919EFC2 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf15.hostedemail.com (Postfix) with ESMTP id B701AA0012 for ; Tue, 30 Apr 2024 15:29:57 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=UOnsx7TE; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714490997; 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=ZEzJZUsSybofDO5VePIm2Jsox1CRrYj7mBs/Ub6qxGA=; b=KshAFvPsxbMnunjx/4q17p9TGvCYedkKZGaCMGz4IThwsougN/aThvgzV223hCyFMQatId DoXnvTKCyL9yfgVCbVGWx1Tf1jPVLhgINHJcSXwsdQCDohhmvAxKGTjcrPGtf7MPwOKLCi d02qhDlPBAR8NuS9skSamK88aoHo1NE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=UOnsx7TE; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714490997; a=rsa-sha256; cv=none; b=wukkVe5rpd3FfkP721yWjc+fyv97gBXftuTujJPNWU7eZxresqk6CYWmxU99EaVpeiAG1c 4VlKeGLsmpiUwlgMIvydnjXaUIW/RVoO7fZlLvTfFOCB3QMQ5n/oVOhxvCQwIBU24zLPDP JgwZ/4KNqFWn0No272a5buxk05aDHqc= Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-571ba432477so6278121a12.1 for ; Tue, 30 Apr 2024 08:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1714490996; x=1715095796; 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=ZEzJZUsSybofDO5VePIm2Jsox1CRrYj7mBs/Ub6qxGA=; b=UOnsx7TEYiqBjAF3ZA06EVNofkEnfJvboiSDebwnkm1rdUcfhJ+6jekrRzR28nOhl5 ZfIWvCIKlNTp8pl4QGC9yyKu2oZ+4NAwsTG6rK2yLVAem7+43XTuU+2bAChattV0VGby kLynu+0oa3TyPXw8to4sx67w4nU5WP+3edHMouO5mtzR6l4beOVL/eFzFwgYWFdMcX1J /6Dd3hh7N5/cj3uB/2X8Z5/Fg5uZ9JMy9KFwDr0E2xE+aVMbu0q+UZ58ru3dNkIt8peL J7xBTKR7kw60+bLCYzvlyvjxyIdKnHcMX6yeUV9Jop3CszE3rUN8PPNk61wlBv62OfpQ 9g4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714490996; x=1715095796; 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=ZEzJZUsSybofDO5VePIm2Jsox1CRrYj7mBs/Ub6qxGA=; b=AwwMb7TGYo0/z5BkMv5Gsoe5VZ+MaFfVcaDreGzxQErElXiA4NugD3umjGe2zz841v 8FbypNsEZMUINP0lAe9vn6OLrgue2spn6KTVdJ5p+EkdYugZBKHd38pCcFK2vE7xRK0v mvKXesugYTdjCVlrcVEUyA/cbcFh3QhAU8tR2sL06kZ5oaYizOvVSSICphA12O2H4Fi1 /Iux2Nsur5dfTehiGDWG82S3RyAewgx0Ro35S+B3hA7BOmuCcZsm7846YNhhVOMY1X81 PtKVNPHaThFIiANsAHBw0bihs/H9XqQ9XN4pK7P67VJ7Ey694gVEGAHJ36x8nkmQwN4U 8FhA== X-Forwarded-Encrypted: i=1; AJvYcCWXqVZutaDUvs8X7iWzSuFuHrwaXsSZtM3AmZAqTmCH+KzuZoThpWazQlTnRGxaHOlFrbpC2Fn1iH0h9TL8l1Ft3HM= X-Gm-Message-State: AOJu0YyQs1YCJuVPlTOLWQHvrot0boimGcEX3U+boy3q67EIrVzf1r6V rs0FURm7Wui85GoEuL+RQhPUJQoeZ/9OJpAUNIh3BqYlgPLNpbieqh71uecJDtk= X-Google-Smtp-Source: AGHT+IF3UKJzBehHUJtTRlpRdEgQMOH7F5I9fMi9n0Epn453OOwtWzdc/kdfdJOaJE2UzkWrFYbxXg== X-Received: by 2002:a17:906:b256:b0:a58:a7db:c294 with SMTP id ce22-20020a170906b25600b00a58a7dbc294mr45359ejb.35.1714490996251; Tue, 30 Apr 2024 08:29:56 -0700 (PDT) Received: from raven.intern.cm-ag (p200300dc6f06e100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f06:e100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a10-20020a1709066d4a00b00a52567ca1b6sm15278137ejt.94.2024.04.30.08.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 08:29:56 -0700 (PDT) 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, david@redhat.com.au, Max Kellermann Subject: [PATCH v5 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 30 Apr 2024 17:29:28 +0200 Message-Id: <20240430152931.1137975-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430152931.1137975-1-max.kellermann@ionos.com> References: <20240430152931.1137975-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B701AA0012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 7kuyxycns75kd5a3gyfmnghbe8cmpx1q X-HE-Tag: 1714490997-202996 X-HE-Meta: U2FsdGVkX1+QMQ9LYdhg78oSdG3j4jOiHJSl047V8gxHhGTtakGSkz3LnShzLm6wz19Sem3FOljYUqS1Piql5Jfu7wUACwclC/newT5+9GMhehebD7Zl9jsQ96/Tbu7yKNw6HvzD5+6OZd1GGWQjhdL6Og4vjFCtafD6osg3sDBLa764WkxEVAGGj6+w1BrTgUivqm4sOVY3zM7AFfSBEet9DY904b9hjacLTWjKGlvzOyfqFUuM1Ps/w6uyDwizhSBsJ5xuKLt7+ruqiIksxxwJ9/+1DInT4bLN1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zojU+JuD8W4NF6p8Au1AusR7zhw11LpFv/qjBnT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000241, 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 7af85220711c..046f960ef70e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1793,50 +1794,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