Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp285606rdb; Thu, 22 Feb 2024 03:53:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW43ourenn8GHJ6SdWIFikZfJlLXgN/Y/OC5XwbOPzgJPy7v5SV+3MYDC3/RPKTpIDXWEA4nkuDd7kQWmizHdDhzUQxk8Mdy3tMRx37EA== X-Google-Smtp-Source: AGHT+IFTHUAxTRVpSsR/r+bEQryecp8chuzSCKO+nKNslS2Fl09prg0HuBgLiUrYPPrKKS1NHllV X-Received: by 2002:ac8:5c08:0:b0:42e:58d8:e5b8 with SMTP id i8-20020ac85c08000000b0042e58d8e5b8mr180230qti.45.1708602799566; Thu, 22 Feb 2024 03:53:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708602799; cv=pass; d=google.com; s=arc-20160816; b=yyzVo3j9sRiEEAPIAUHdEzcdFUu++3b2GWHwhPisrYYiADTwv9infvLEmEsSGWEjc6 gUl7L0gKYquO9KkULZelbAteHgIDqHhdK58RANa1lYz/EvKFBMFBQIdkufuup+Ry+Pr6 VS6EUk6dhwIC/iFd6FKUZAaHzN+u05Cslt/PTKFaclKIgUK7UDeUPw6e/R1ntWrfxi6H /nSaQXyZVAOqqcSQ6KzDslWTQSY7zkwuc2eJCX7ApRrAtru3LaeKNwPnAl3HH9waHuyq vKVGKUuHlLnOlofLWUouwxiV0FSq8JOazuT3EFjjtJNEgqCnNhgngOCeOvmu8X6eDfGn PMyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; fh=eXN6tW06cj/b2Kv8/mW8eVA4gquChTGuRqAk/yEAklw=; b=Jk5gihJJTGTHUF/gEqEj5bFeSyxfv0m9V577O4SuTgbC46ufQ8z1t0410gZsfFC2Yb auHgQA4pI4WJ0GbJZ46xaf9RFZfu660yrd5HDaPXMO2cLCHWRCVP/bQVEmCewrR0SoP/ AHlMnUYcI5b55GoArVmx43JyUsCJjhgGSrDkfegf4KE4am8FKdB8MFBQP3EPrc2ugawI zo5aieHPI0aJB0qEe5jMERv/bHhNrXW1+MQvDMQW/gkIBAgWP/edKMZtZJ3EnSSgpQGo kljOWdu9PFkf42oCtpcjyE8sUAgPE+ySP5Rd6cVyHKeJxW9dUyvLI5DPjw9BdXbOmZ0y bPjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=iLEp2xy3; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-76459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z25-20020ac84559000000b0042d4c9bac63si12005838qtn.273.2024.02.22.03.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=iLEp2xy3; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-76459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 456991C20C67 for ; Thu, 22 Feb 2024 11:53:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9055E4E1C4; Thu, 22 Feb 2024 11:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="iLEp2xy3" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C925D4D595 for ; Thu, 22 Feb 2024 11:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708602676; cv=none; b=L6kmh6pBm+/ngfcqd9t6o9Yg7Wei+jh3wyKnO9C6t9eu584rcZ9ZG3kB1YOmgITtopf8vgDqB4h31K9/lywKRgJbV8D0J+0EZ8WuBkdr1aP1M4qpw45x/M20ZApRZHs9NJMYZgVFCQWEm41gxi0xAQ9aeWlSp1XaVJqXPMOweeM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708602676; c=relaxed/simple; bh=YgLBTN5D5Do778oi/eRa8MuhD8uhB7i6cOaSs76xSFg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fWTYQ9y3xLL1SmezRN1NAqxpIEhkJN96lBMRzE7KvWdaERww7upJGeqpWixmZzmNqFggCInziO1+M72hvs0ePFDryVqhXQQsyQtzEMjH8dmmplhl7QCkypqk8mtz400e6kEUeFizdBNrLJDIAVLLynbzs6XNN5CK1We49SUsmdk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=iLEp2xy3; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40fd72f7125so12500185e9.1 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=vger.kernel.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=iLEp2xy3lgE3c5NLP5o2VV5AvN9CRHm6ppuS3EAwBSuuBJPxq2cmLIpYDBIPjLk3op yLDvABdIiRvDy6z3qj7QURydQTkBRK8b4fQu9Suyx+PHp3i4DB4B6no+JHZpMPSXo/Ng q5rAxSZvB7kMVtRC06nbAWFa09SRDdfbc2POXNoNxN4fMNWeDUdHvgV0xh/Q19Kq8ZJc MyMDNUU6V3+vcURJW2HoW+pXxzY9Sg8W+5Lw+jVGZzUIlsF26iww6YEDFhPqAiEm+xXX 0Xh/rxiVGPnEYYJaSgPLB78oBAb3Faej8OVdaybjVr2rHClOr/hW05CxPBJuuGdBgki7 Q9EA== 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=UI8rVDOTYI9V2hvtV2idJVIwCXGaEcwTtvFWkpLnI23ujg5cpM8uuJ0vb1Qsash9Ye AvaBqmFNDnogYH5ILvCcas0hZEZEn2RNCvtZ7WtNQbtyg9/iYE+GM8O2IXjSc++cE9eC lRR0k0VPwCb98i48xOMhi+EqZ0O/cPjaKOE37pGkXUBkRiTQmvyHvJviVkNzRuiaACB8 CVIAmdvbrEm3JBoAvuMTmnbdeR0MxSJSag8PgIeJ8SmgaXFswzr+C4zj3YKsZbw87R/D wPHn/+9MBxuBfm+6xYeUlEp4UQ/PymV7+1y1ip9mkVPXKVTe0jy5T7GwGc9RKaiq325v 6ttA== X-Forwarded-Encrypted: i=1; AJvYcCW4O20XeQ5apEOu9KGYuI//hOsCoevmff1Ec6JP/C7k+ZGsC4sCTc0+oLo0Ux8GpuhUoObFYSGE1ryV3C5iWjaGuDVgs4rtn2JkUi21 X-Gm-Message-State: AOJu0YzxZF9CIq4L/E9ujfTeQHXxYqy2wOdWRJRpR/scUfurm9DSFysh 3Ufc5sVNqHBBwKXGJWG+MHKVEB/BFPr3ccfSzqTKkJ5E87l8UpE5PzBLdGFmJqI= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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