Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp268137lqs; Tue, 5 Mar 2024 01:07:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYL9YsFYKPrsEu46N+KL579rz/GLoWbSkj9bPXNQv31ACDrINl+/cNu2enjiL7Lmn+TXrFkTumkbUPFvNgdc+RTCN2U7O7uxhO5QRUdQ== X-Google-Smtp-Source: AGHT+IHkpNUBIYsoshkHODcRh4lyJ/TNFq1qUwksYsT4MK49oijdHtAs90QQu+rl58czqW+ODP0A X-Received: by 2002:a17:903:120b:b0:1dc:c10b:1745 with SMTP id l11-20020a170903120b00b001dcc10b1745mr1791376plh.16.1709629630370; Tue, 05 Mar 2024 01:07:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709629630; cv=pass; d=google.com; s=arc-20160816; b=kOvWYNkgyDJCn8L1K+pLvJ9RJtle3LGT6u+mm602PpcRroA4273MyNi+iRCrsuhxDH IC/y1ATPWuh6iML+mTRE3H0lB/7K+MWxBp59NY5LmmLno+y1joDIjio6FpdUF8vl6RQ+ gmOm4FynXXWSMvY8no0ymecDOH1DM7b07Mp5xLrPTp+r02xOPJ94HtN8KurSSqxDFceO /F5VslwIdXwcHELghqVKGtg/pcmp6vv4qxbR02pmePzMVwSfNVT73S5pRlCMbpc/ouwB igOM5mmr2CjVQi2Ufopvmj+bV2sB1lf/G6PJYCPNMC00vw2B4fXsb9YbYiZLP75F37f/ BWvQ== 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; fh=RxXxC8DUvJgJnhB7pq9YaIPuH6mKAvFvqDpzjWVK41A=; b=bf/JKnDWkjpFbh17YOEXEfjgQm0iktXg9wDryuDUyt0OKj6p7GAzbDPxqBzF1a2qun BaYe0Twh9fCHzhown13Yd+Ppn6AltvBZ378X34lxjsPeZ4dvnkJhBYl/b2RsWSXtie6U StpkAbkwTga/rmuCEpJZNUoRfF0WOKWfZTsoA+WcNab6Ma5Pzxj055ss8mCviwpbS8XI Y/fT4lmeaIiB/quHtOI6uVvaxjpcHA5HDjEItOp41z1x55z6ovZegq1r8SJKyy6JgEr/ Wcl4f6gTO8iLyjM9WVJZ+bp6opfjTJz+PpcLlGzueiyTq+apFEHGRlJhOFMDYTHx786o iOUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Av01YWKG; 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-91943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n18-20020a635912000000b005dc210489fdsi9666611pgb.63.2024.03.05.01.07.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 01:07:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Av01YWKG; 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-91943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91943-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1E34DB24B45 for ; Tue, 5 Mar 2024 09:02:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B697A5677B; Tue, 5 Mar 2024 08:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="Av01YWKG" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 CE8BE54FB5 for ; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709629190; cv=none; b=WwGVpSCnNkT0YA5y1YkHE7/3QMqGbFV+fJ8s7O91sxO+bBXBSBKtF9Sy6LWGjz5kil/dpCggTEBdT8FxCK2nOffpUOMSUnkZ52oiFYL9kXk2diDdHpAcCYOp9awqFbN47oWzGtwFCoWUzCFOmNkxhvbDTBkGFPAmjmDLCmA/7WI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709629190; c=relaxed/simple; bh=gvv5QAtWzHwpsz/x1Apq4Lva4NNrjhRHP3W2M/SGVoQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LfcAxzZUfAkbuWSdSFAMlr17F4TgNqknuM+vtWbTjhw18uqfKeAUmTOjX+bQUd+++iH+BNrfwE0ReBUSlUNxAALTAAjakpLjD02JMHCFmXr721c6+qmvNT6qNpSb/wbPDg9pT6CwhL1/5RfZt+xzYPlG4Rq8ATgkH7bEc20Hf/I= 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=Av01YWKG; arc=none smtp.client-ip=209.85.208.50 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-f50.google.com with SMTP id 4fb4d7f45d1cf-5672afabb86so2073549a12.3 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=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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=Av01YWKG56143FLyXuR/VOF9CC2vjqn/UcUkxVJbrP4iYpGlPBcE5tVLf/CI3Onunt +M57gaSftQ3y3bD/dWYxEIgC8Ak/XbblxYlRG69wovBA9Jhwflx6RQnlCSHsCgrxw50l oDmHyV6lPRnkI1bVMH963jsamXvmkoeuG2AaX0R2aI4Ti9CMWC0m7+hwOaAyLfTl9tus zGlZn1du7xNIESkky4mMQz0J9RuU6gq6vAvNPPc0Bul34ig+u8kWekeFYjSlzyGZyr8G pgDalVlVGLWBQE0RfEZA7DUIB7BnjJmKxnHhqCs6BZb8S0JYWe3YlJdQUq3cNPh0437h WHiQ== 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=NfI/3y+NjsOb2qtNaqQ88mC8jr1A+dpIPKqO3I9JZiUO5kkvvcus7cY8atXePkM0rm MwXhYPHYEcT/OjFon5luCaMOzxkCxOM2S5DvvHVENy0WplaSDz39+kCQ9CT1F/6bsk+j KefLuWAQHFmhfqyUwf2WfCmOOFMJ0KXxC05faLpsGITOlcAKmBzvXHHD5YBrgzHM1yQC Rk1wJifoX82jrmtNVmesadmngBgwXMLxVrPcVVzIu4HAg5yGdurGgolWFezVbF9nUAbp gUujpGbelwtqu6rsm+DNSH8QidFogP2rGzLSvF7AyvLjA4is4mP7FkdOmjJ1431ex8eN D1wA== X-Forwarded-Encrypted: i=1; AJvYcCWeSZ0oG7uAnzUbS+hUDqwJ+0h//s5dw3NQ9thyjHvJ3NX8bOrzLpmJCjiWd9XHlyOlYJjjqLRObgPwyMgEPWXWN1Cfb3guStkAhJI2 X-Gm-Message-State: AOJu0Yxvm02+WJSne6Yi59kJj19CorwLbUWwI5wnPemTilg9Aa9JSfGR 9JpJZSb4gI9GrSlKY65cl5U/zhfvdqYEffVq/xM/FCgN58AHWBaGDzb8znqiGYYds0F2KzfQrK9 y 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> 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 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