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 48F61C48BF8 for ; Thu, 22 Feb 2024 11:51:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B20426B0087; Thu, 22 Feb 2024 06:51:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA92E6B0089; Thu, 22 Feb 2024 06:51:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D5966B008A; Thu, 22 Feb 2024 06:51:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 767796B0087 for ; Thu, 22 Feb 2024 06:51:15 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 53A561C01D9 for ; Thu, 22 Feb 2024 11:51:15 +0000 (UTC) X-FDA: 81819274110.28.13EAE28 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by imf14.hostedemail.com (Postfix) with ESMTP id 6745E100010 for ; Thu, 22 Feb 2024 11:51:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Voxr+Ga6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf14.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.53 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=1708602673; 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=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=mBsQ2nT9YC54wJbLxwBZfKbMzJ24SCTNFbM5QxhzYn/kcDpZ+PxwIs/+Jev2Arh2JHMDKJ Jqdxi6bR3pOfedd/hSch1IxGakdTdS2f39s2rNx1WbZLpSoByDIvCrgULWA8OL/h3g2l9C kmcG6K2Vr4qPjCBfEnTeMFRGuJe/smU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Voxr+Ga6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf14.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602673; a=rsa-sha256; cv=none; b=tL0AZyFyZ+wIoyKhdRR7MTV/MKSZqHcyhDoIHllSdHQglXXL4/FaaXrvkZwipEkUWNmv1j p4myP8xCoGnnt3q/fmZKk/d3ZEd1z8zsaTbHaCj5+G0OxdC9AbyTAPnhX7XYOar7aVG0Yp 8lGC8nFcoAsB9B2VkvXtKyWNHFPaot4= Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3392b12dd21so1299558f8f.0 for ; Thu, 22 Feb 2024 03:51:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602672; x=1709207472; 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=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=Voxr+Ga632dXM9sYWto71oaQAg7BNDV2sg3sbdgqL56wfpan2dkono9tbUTBc4OTr1 UhvWS/yEdKdB1lmeAP+xrgjoLA3ZjPshEXMLlLoMmrAMxTf/QaIcEJ4N8NlKmC5GOdSo KHo6LHr8PbXct/WOluppwWyZu/ZwEfzK+L4yj7Z+7d6F4GpWEsXQA7jcTp2OEqIKtPdO otmf35QLGErB4KE0FBnTndNzGljwa4vHnv9bzmRS3T2GmhY82TcyI/Ks0gnRCWhzsbmS 9+mtT3ICmtZAVZ67t1nUCLNaRtWEJ9MKOpmsZbzkRePtmbXXBZLyQY+xC5iJKcgEnqBP vPyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602672; x=1709207472; 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=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=gPpYFN3iKL5aFRb86Bm6HBbKRGK0yP0b6w/FqftNZykoXWMyyxqkeckCGuYekgVXBl q5t/zKpx1v41WW73nEozHaHAwe3xg1NiKjuJasu9NDmIB76AhSsHf17VGqJLwDJPF8UU oJsT6LDP8LqUK4pccznKeG4h+6FBfPAGWL45FLB0wqGWJ1CJTjexr8lPRbbb1mrn+bJ9 BhNznI5Aaqw1cVlsqOQO5d8CUcK5EOapZPVr99/gyv1Bx93Dfx9JSA/vUpTk+H9i54Rq ZVHMXnMrYmRHvSNpOCn0hxqLGV0v19hj0165Kg31BgPf1mKkkv5a8f+PnOnFd779GnY2 Qv7w== X-Forwarded-Encrypted: i=1; AJvYcCXCDN8ICoBFED8j5wlP2VaxJvy3C49nDbtFhZdAIQj6e86yaAxhSM1E4xoQJqKjiTYg5orl7+gYVnd/PcOZP5Br09w= X-Gm-Message-State: AOJu0Yz/FGU2FTHqSQc4S+DR9jj/qLTDw/56JdoAdTCE+p93/rObHD6j cDFCh+SBmOQnmFF7JeNK22EN3zhBzSE1cICxv4KqhjlJqvQ9SX/Gc90EdgXsMms= X-Google-Smtp-Source: AGHT+IE7GlQdOA5ZITSqjxJZEz89QZSFz6WL5hb8Ohh0TF8MgsaND/DbLcX8ZehAKHAsuK2u2ZaU5A== X-Received: by 2002:a5d:47a9:0:b0:33d:3a06:acbc with SMTP id 9-20020a5d47a9000000b0033d3a06acbcmr10659700wrb.70.1708602672077; Thu, 22 Feb 2024 03:51:12 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:11 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Thu, 22 Feb 2024 12:50:52 +0100 Message-Id: <20240222115055.1172877-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6745E100010 X-Stat-Signature: oo9co7xbzm155gkgw4rnsaq1kp5e1fhe X-Rspam-User: X-HE-Tag: 1708602673-708885 X-HE-Meta: U2FsdGVkX19u8KD3wK/vTMYt7KWWgtZAFLOo0wUftDYuxAibgoezduaVmf3s/LTKe3teL1w7/owDfcz32jDkQzrUj2uqjb/kLeNgFPmy8vE3pebWoenI1X0I4ZrFixCjfBiGK+7ndNeKunQwcG+8AAOOUCusg5c6ss9b1IU/M0RxwmCD4QhZ/m/SPYk6iC6w4ljYk1YsRRP2Hg1kr3gMyJJ7QWlkeMOxlx8xRzllDjSz0iCgLUpyfE4Q3T11sLTdJBwibE+cGLE+ldoptD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EHPRGMF9vY0r4U5VCKXTFSPOVwuha/N+OOVDbG1CaRQGq5Hn2CiU83jlxhG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000821, 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 1297ae7b2541..68228f43e7ca 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1749,50 +1750,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