Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp943040lql; Tue, 12 Mar 2024 02:45:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBwDNVDNkw+Roh8spbYT1NUw5tmt8bvhOkm1mEl3gAwIlJyLA3NdV/g9ZeHJ1avLTetw5dW8PFnxJt7Cfg9//cuR770J7p+hZQrU4Kgw== X-Google-Smtp-Source: AGHT+IHNcQ0Z3hYYphC5g+XXLTpgHm/+8qkns2g79UGz+0G8aflmLF3vsQFn26YFX+xgQwo6oguM X-Received: by 2002:a05:6871:31b3:b0:220:8b6c:80a5 with SMTP id lv51-20020a05687131b300b002208b6c80a5mr6497020oac.24.1710236725825; Tue, 12 Mar 2024 02:45:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710236725; cv=pass; d=google.com; s=arc-20160816; b=TzqGNgRqkATNHU09K/PCmhMeQUfsqJBRXgehvrtLIRnl8QE4lMCxk3elIcDSOHFT8Y E7MeoGII/Og2WjIGLXVjZkyMUKpU+HQcLJRpOPrKtQBD5RMGucO7dX5tu0pbzSMOYoZx ghXWvRX2Y/jlomh0BHyQtal8+/GzAYIkp2dwXqKw+joZELZpxct+sOe9RZX0ZhI1GICR nV+Uc2hCL1TORirH1YbJO7hsbTjTPzOpHAIzTctybeVRJ3pzCk58LRX3SQ4GcXh+wl4e R473FqX1Iz0emnDPJYh8FqlxR+RZ1hBMczoYW9C1nRzgKOTFxKwnkbhhAtm6Q/AU2/7b gS7A== 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; fh=jVqXJ2pXmXw/39o9iVD5C5FqnFkhRpthiC6j2K5qTXU=; b=hocer6fk3CJUnB2qZ4zR+A+oDZZXxmAHpM7oBmKiVjBLpcZild+5caP6PuNvv4Xp90 BYu64aQCicB0IBmraSD7hiq0xDPXyWpLXrN07y+ugryITuexxjUpKt+OuuyK6MXXRU5Y k6fixwBPK60+fJ75dAVIvNQpA3tZPvFdbFSKPAq19nu35f3ll8Tw0rVGltI2sICE/bwa HJClKusM5s4WckCBs8sP6jcoeqk3I+CJzIKbHjhUcbVWfFXaaxKLQ87/+QH7pUx1B8ct kdizezWcD5PfJ4iwmYzd84H+ohyxccwwgmUNaTBDtDkuqkGLrwK/11b+OlPj/5nqkj53 4viQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=XZoEYIcn; 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-100050-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100050-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 t191-20020a6381c8000000b005d24ebc7f36si6502441pgd.406.2024.03.12.02.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100050-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=XZoEYIcn; 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-100050-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100050-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 778362812B3 for ; Tue, 12 Mar 2024 09:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 293D77C0A3; Tue, 12 Mar 2024 09:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="XZoEYIcn" Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 36B337866B for ; Tue, 12 Mar 2024 09:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; cv=none; b=h8BbgNjWGu73RiN//rvoK4b+FnmXxxCh4YNkB84NlN9Fco2hugeFE/uRX0V2siiSwBU8kSYmmbew7Lfg03VB9STyzW14omLgrlMhDpI3OEd5gvqLVvIbQMnuIMyUN0R6PZGaQjTKeJTlLE2rAPJVUydCm/MsedBp5ezQ+W8xkzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; c=relaxed/simple; bh=NEV56k/1bcmu9rz0L5zz1lY42ec57ywMmk7znO1WYnM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZdGLPFTMhZt1iOOsBcwrFjmFW/0mfrau7CRSQvOKj5tp/uQcNqcek1Iq+HV+QQavqwR8X2XjcIn1pG7hIn5uqW4dqu+9t+recgse7wreZ7vgALwXm5BWxgbxXEA7F3ovzjvKUfbuU+wlPeVIvtPuY6BXm8OfetDOu+1fjFLnYwg= 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=XZoEYIcn; arc=none smtp.client-ip=209.85.218.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-ej1-f53.google.com with SMTP id a640c23a62f3a-a45cdb790dfso545729566b.3 for ; Tue, 12 Mar 2024 02:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236520; x=1710841320; 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=XZoEYIcnINJYx2Q82RNXNLwqjk6pwQ37uDR2uhQ7M8w6V6HYDbrK4Xg3IfBGvIf1Jm tEmRQVqCYSyQGExekQpXNh3jsZ0Wn6enxsEtjWLetmMfxA3DfBZKd+tqvf7gz6T0Ghw1 fWXHcYOaxTOwKnrU3Qhl305pJFAHfQLE70B4L6msNo597GoZ7TBmzW4n6OMi1lHvFNQ2 7i9df18KtvTckICKTQFc6X9HJMt0tyYi1iTXUqLVSbHffSG5a9xQjEeQAPE97FZbsP3q Iek3MMH1UXnu6DAdjmJVBNBtZoYawGsdiRtctKio97ePwLkQwKw69r2tlQp9DyBaSVMJ o9Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236520; x=1710841320; 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=U+jsh1Z0YK6rucMOclTgB2RzfGcx6L+EShQ2DeSNH4Al+tVt4zvxwFRXPC2yvcvtii /+gmD2UP/A6gfsgtmdlNRjQ5vSJv7LMLLFM23DWZ9VuKYhGGRj3dZpvMSRjFz9a7n/Pn 0jhsiH4lvdaFcpwNPCSZYvnTUs/OSqBfnHz0dYldg96fpnL8ZpqPoQKNhnhMOz7UBu1c 9/jlwrbiMgHfiZejn+QrId3wswg114xCBpKMvT+wVeyu0B8cgfXxI9jnJY2uRp1GlYNV wKdnbZKzHduEc0Hl+5f8BjBWxtf3zFwz097eAerCkdD8uIIcFupJ0+0sIspzjo9vPdc0 5k4Q== X-Forwarded-Encrypted: i=1; AJvYcCXJOswxNLxxBAzcnCV1xDNys2i4da2x7Ff3aop9e5gyZCsU2xtJT748sg3XCK3yjaAsf4sN39ZDgRU/WBMs8QLWYRTRmEpGDaSG646h X-Gm-Message-State: AOJu0Yy83RIjlb5PpCDOjmk88MJnmDfiIMbD6Y6XOVf72ODcvG5/lDfK 7P9g//7GsM5Abac0kp2w2nTsLvHzsPZLb6LlM77vOEHr0+QI4toyecZkRWfxpvQ= X-Received: by 2002:a17:907:3594:b0:a43:f182:66c4 with SMTP id ao20-20020a170907359400b00a43f18266c4mr5390555ejc.17.1710236520620; Tue, 12 Mar 2024 02:42:00 -0700 (PDT) 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 jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:00 -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, Max Kellermann Subject: [PATCH v4 11/15] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Date: Tue, 12 Mar 2024 10:41:29 +0100 Message-Id: <20240312094133.2084996-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-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 | 28 +-------------------------- include/linux/mm/folio_zone.h | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 include/linux/mm/folio_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index e8a914e7bebd..b3f83fb26aca 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1370,33 +1371,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -/* - * The identification function is mainly used by the buddy allocator for - * determining if two pages could be buddies. We are not really identifying - * the zone since we could be using the section number id if we do not have - * node id available in page flags. - * We only guarantee that it will return the same value for two combinable - * pages in a zone. - */ -static inline int page_zone_id(struct page *page) -{ - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; -} - -#ifdef NODE_NOT_IN_PAGE_FLAGS -int page_to_nid(const struct page *page); -#else -static inline int page_to_nid(const struct page *page) -{ - return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK; -} -#endif - -static inline int folio_nid(const struct folio *folio) -{ - return page_to_nid(&folio->page); -} - #ifdef CONFIG_NUMA_BALANCING /* page access time bits needs to hold at least 4 seconds */ #define PAGE_ACCESS_TIME_MIN_BITS 12 diff --git a/include/linux/mm/folio_zone.h b/include/linux/mm/folio_zone.h new file mode 100644 index 000000000000..572fe37068f1 --- /dev/null +++ b/include/linux/mm/folio_zone.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_ZONE_H +#define _LINUX_MM_FOLIO_ZONE_H + +#include // for struct page, struct folio +#include // for ZONEID_*, NODES_* +#include // for PF_POISONED_CHECK() + +/* + * The identification function is mainly used by the buddy allocator for + * determining if two pages could be buddies. We are not really identifying + * the zone since we could be using the section number id if we do not have + * node id available in page flags. + * We only guarantee that it will return the same value for two combinable + * pages in a zone. + */ +static inline int page_zone_id(struct page *page) +{ + return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; +} + +#ifdef NODE_NOT_IN_PAGE_FLAGS +int page_to_nid(const struct page *page); +#else +static inline int page_to_nid(const struct page *page) +{ + return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK; +} +#endif + +static inline int folio_nid(const struct folio *folio) +{ + return page_to_nid(&folio->page); +} + +#endif /* _LINUX_MM_FOLIO_ZONE_H */ -- 2.39.2