Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1478505lqj; Tue, 4 Jun 2024 02:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzxgNL0AzIEjSb+Y0LQpFHrmVW/FnfaBrhdJMnRKiaYlGKHUDoX7mam524l6MWYfubVcoxRcbeFo8rOJ3XJedARSDiz+skmbqVCCZoRg== X-Google-Smtp-Source: AGHT+IEbH1OHtH0nkt90L80BmRWDr/h+K36RH7do3rh6UrWxs8Q9tIUk5Q/Zo/yD1Lx/oR9j/ZET X-Received: by 2002:a05:6a00:b44:b0:6ea:c7bd:90e3 with SMTP id d2e1a72fcca58-7027fc4308amr2882522b3a.14.1717494685967; Tue, 04 Jun 2024 02:51:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717494685; cv=pass; d=google.com; s=arc-20160816; b=kgULkcdDB8ebPYGGhh/5U2/N+NmclMxXaBFSh/FQgPOKt8RzkPHfyj758NP58IQLmY VRSJdJmFCFYxc72+OOtHEftuN4k3nkoMbsux1wwtGRQMigUX+wO9VK8jXgqGPa7fJ8OI sVol0pRprVAHpafVXQlSLwAmKyB02IUHPy/hy4af8ZBP2ShKgluqBORBGRQdLXpLpilr He87PyFrvY1LizkCGBxecy2EyVp9JSx7n0Efup0tItkUoz0eNeJ4PTXqGBB46KN79mxS IdQgN+0IJFU/D057DHXEN3ZbEKg+IfOPq3zKm7ghSAKjB/5jP4q+NIUxjiAN2J9zkgme EFjA== 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=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; fh=8gCzpKuhZiP13cPfUpAeYka90LJ4wugAz+SY7eixv0Q=; b=xLjGx6PoksXoogOu7HE6lqInFWsLFb1iEfK5glwaGH5cnmyOrvs0Oz4eo1uGCQni7m 8bb/qyPVJmkITSsTgHAV7/Ave92cXDJLVLxjg5yh33r1+BkKQtF5tRe0d6TGP+vp8pkl WMx3/LKbivHO33DphMGcqvs1H01z6E5sa/PsVMSAhV6OmmWNR7WJ5Jsgsdvl/7nkAHWY gtff+8VRuUiMJUvZtq63LtKSK66SbldlwmWbAmM3G/7/Oi+Qhrr24zBJla43zYDavtum GGOHA/mBxs6g22KvNXNUsqq1q0Jtm9Yx2PRxNANGeS5e63+cz9GmwXVGo1pHf9byUgFp Dojw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=iizB5ryk; 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-200322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200322-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35c180bd2si1935751a12.666.2024.06.04.02.51.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=iizB5ryk; 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-200322-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200322-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D5914283297 for ; Tue, 4 Jun 2024 09:11:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 098A91459FC; Tue, 4 Jun 2024 09:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="iizB5ryk" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.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 E5B0B143870 for ; Tue, 4 Jun 2024 09:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717492165; cv=none; b=ekX84zIwZ9DXQreUqXTohkA7yZGrmHBKegEcd9jJ+BvxFbUmnPo1ODoco1YaN/HqNQbxZq6lCF03lhNexfW9XS0f8tBbVMNLfFFWTkihA1lkOYae6YFiEC7nz4G50WmtkxgQda/p/P8w9Edr3Zv6CVnmjzDBs6bp9z1HUqw7hjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717492165; c=relaxed/simple; bh=E7omIAd4oioz178wbahLxCf/I00afQCoybuhoNDREsg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UiRkNrpO2KDYVX/grYJOMpkQfy8mo1QCb+79rkiJ5rrW/MSEALApuiBKyJBy8TPLtmmRoPE6I9B37Xg8FGvvwahBL/RuSDqx/LE5Le8ERTpgQFoSKaaBVwGDcJiQxwJELzjxGwE7/Tovak1JhsJrMGv/HornGZIUCqRClkb+VYY= 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=iizB5ryk; arc=none smtp.client-ip=209.85.208.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-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-57a1fe6392eso6069898a12.0 for ; Tue, 04 Jun 2024 02:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492161; x=1718096961; 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=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; b=iizB5ryk4QWnKCluE/rRqllcKR4DA6W90mXewvxC5i1XnoEgg6uOPKE/YRN4BOiNGm jz1DGQvo49Kdr0Ec4LaIzHbDrE9zh1DyPuhxN2Dud380bt4Zr+1kC2djlZsD3QUoE2Gf umLOMSfeRN3ASTsv2LPRL7tHeegNXwhlC/y534l1PNyyXhBiOuJh+fxaRg+N7QSikgai lK5vnvVjVsyXHLBKbidoeWnFsCQkN/UMDDh2v11mKKvYZD5298Mp9rELhvBFsRFh5vXK lGw9dHKFla0RuFfgk22FCOqTNclqwb888vJV8kW8eEE+7TxVPAqKVxSVkQOeyKhTLf53 4Nrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492161; x=1718096961; 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=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; b=u9zA0QnKsJzvRrcjK2c9YTiXHCA8SHUIeltTZYrw2rRnA/u2lMgeOWVBOlIAvxZxVW vHGE481/miVqNxLYP1fjEI/kxFBZn6RIY78WgwDPeLXSt5rBZG8XO6CEI+TmNugxq1qd WHREj/fUDIfO1F/rtkxI9fhUuUh2tthvXrHyOs8apLGQgiIzarFM3AQ6olGX8EAerkcb RXciLn5aJ6iBKx2z06xE2hZE+TGR3rTRudBTptSZSEs94QZLLLqVzeK9kzq8tqVb3vq+ rb5rXQLJb0afaaXzq/nn6DyPNbeIyQEOV9mOt0mr47JRg+ONFblegeqTzgfGyNgBrrSI sIvg== X-Forwarded-Encrypted: i=1; AJvYcCUlJlbOVDNyy0Mnzx31Yur7EbKgdsSO77fYfSI4+An8/O4FQyekPPmVliJb4YSTuE8noLM/VbdZEnG9lKQUDamskyh9jajPK8fdHtz5 X-Gm-Message-State: AOJu0Yww1CJ4NchR2nzsDL6y1GhkoDXZUJIRGzI4vBU+Z5obeLNz3C7/ PNzrAemAqKXcCDbn1OLXrSjHxlw14HiVCl/tQWSjyCNjqGyFCNN1Z+Yeru86YumxAxZwHa4VEh3 Mw/w= X-Received: by 2002:a17:906:f585:b0:a68:f0ce:9f2e with SMTP id a640c23a62f3a-a68f0cea079mr465457066b.44.1717492161256; Tue, 04 Jun 2024 02:09:21 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:20 -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.au, david@redhat.com, Max Kellermann Subject: [PATCH v6 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 4 Jun 2024 11:08:42 +0200 Message-Id: <20240604090845.2182265-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-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 c026e58e3725..e178bda2525d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1772,50 +1773,6 @@ static inline int arch_make_folio_accessible(struct folio *folio) */ #include -/* - * 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