From patchwork Tue Jul 9 13:27:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13727981 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 C6D02C2BD09 for ; Tue, 9 Jul 2024 13:31:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62D556B00C9; Tue, 9 Jul 2024 09:31:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B2826B00CA; Tue, 9 Jul 2024 09:31:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47AA46B00CB; Tue, 9 Jul 2024 09:31:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 278A76B00C9 for ; Tue, 9 Jul 2024 09:31:31 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D8A4C41991 for ; Tue, 9 Jul 2024 13:31:30 +0000 (UTC) X-FDA: 82320301140.05.36B0530 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf26.hostedemail.com (Postfix) with ESMTP id 16056140025 for ; Tue, 9 Jul 2024 13:31:27 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720531858; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+Tq8N6vdah0iKgjS8mY5dcOFkbDz5DS4pIzK8i9oLY=; b=TdC6tK/Ux4d+0vIMT5F4yGrblylZmInNkLoJRYRkuynGfUtlXX8Wnt4/2N0ReGRo5i+MMN /2SbPLrgtwwfPaKk4VbWcF4g41AcJGC0dznpxe3OCU9fT/aeUHRFp0IIywr7yb3jFbvAvp rL812aOk3lNSt4jIQU9nz+6cG07UsAQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720531858; a=rsa-sha256; cv=none; b=JZRX53qMqGWR3I+8zUuBlsH/yHG6fVDxtftZsUOUJRmN9WBtiymFxTNiH24j1f3t9oqEJ5 6LQ+ZeQgS9Y1uJowXGjE0NCZAcA/+AI3gvzbG0PeGC0MzYeghWm0At1B1MjpVVIPz1Ue/W ASRCPUyjz0wOEWyyRkoFzbxMLZvn9EQ= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WJMG85xBmzwWGp; Tue, 9 Jul 2024 21:26:40 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 61D89180AE5; Tue, 9 Jul 2024 21:31:22 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 9 Jul 2024 21:31:22 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v10 12/15] mm: page_frag: move 'struct page_frag_cache' to sched.h Date: Tue, 9 Jul 2024 21:27:37 +0800 Message-ID: <20240709132741.47751-13-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240709132741.47751-1-linyunsheng@huawei.com> References: <20240709132741.47751-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 16056140025 X-Stat-Signature: ox3kc9zqjmtgx6zpw7hpk999gepuxd1s X-HE-Tag: 1720531887-834017 X-HE-Meta: U2FsdGVkX1/7EuppA61CcRecZ+G3RMzTS0UM61qmJpDUYtIHKlCFfaSj8mGrXJuaRV+5mdlc5P1c5FiUd0Fdzrbq/y2LEC6SKedWf5Png6Si9wQN1a/DijhEn0VQ3tJOanCsdi3XY6ewtUujMPsF0W3SOqWm0czhETWAaHPKsVDuaYMybKxQYZDDC04mOa79VnPmsbWiFIVztojA0ejQVs4pnfYt10BdYbrqtGuKKQ22QIL4oVnqpnzs4yWS3QAILNy98X/OCQScBS1THrXmdMk4AmXsWYjpGN9RM08/6JxIMOGVQWkHLX96AMDUA4JonT0XKa3KXP+JXudDUPyPFmA31nZOHcP5x1YpwnE2gdyKcPCeiILLv+YcmsuL/xhXE9Kamj3AutteeC5d/07GpBRx5HpB9rIULOb3SK5vAw/sBtb81zM6499OpUiJ+oMhx14tfijXEFDjVHnDtsbSQKe29vh+HzyW9+YU+F/yKrVxCO8FLnOhi4WgXd++e8uSrSLcpTJw5dCZ6UiNoViZmos22sZVHTaC2VkmAaaEWX3dw2V4DZIv/YyuUiAaIyfAEgxBfYP5V2CQMDl3oDcAXCczsISclftBEGdc1w6jyf1SzhndXcUFLsxbkbXKXjbrXZ1J4C1CQhRoVwKXZcit3+1qXF6HR8R30G3jcSkgiypjX52ILLz7TqHWjZPNvemOMYUjSCj+YWembbSrL2vt17NUeRwCY3felSONSYa+SUl5/mqpd9hFESOMakXl7pELs/opQHJIpscV8gD7Up7wlp9Z1zQX8f5tAQ7YAVtp4X9mBV8VBk/2VZwQ9QQ/g+c1HqtRPaipiEj8p6mpf6upb0AlIdLzJpJWM9iDUGlXO0jcEYuoILTv6i4NYp9uCKZ2IXfJH7Q8VgpgIZQxJ7UL0+QHg+PXmNcgTI4fLkuvf4AMKPQt1/8aHcdeQ8HRqf9uWWWo1sa6sy1rSKpyyAe hValPSwP q2co1OreHo7IQnF6wRZ4C+CZxDbdi2hqcXWQ3TZgwETB/s3I3GFIlbYoB4Mm5Hcfei7QUNEuU6d72cy3l7fEAReBy+usNQ/qhEyXObi2Dd+Bqq7tvnHKXEi9My+u5JrSp4G0xgJfl5lQYllAU9J1CLsWgv17168KZUmwC/rHAgjhxJ7NoWk4ztbmp2C8ZLlvy/MiJcD2ollzzDDxqougoypHE6wyiY3rkP05x0aRvoJhW6x763TNHhvlvtAmeRDcUPpBozqRwsDyfeucwej4K9PrdOEriKOqu9D5LMd1F8rffqiEy5/Ntj3DeX0+H2/m4dBpPZlejCZwZxxroQ2MYMSlG8w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: As the 'struct page_frag_cache' is going to replace the 'struct page_frag' in sched.h, including page_frag_cache.h in sched.h has a compiler error caused by interdependence between mm_types.h and mm.h for asm-offsets.c, see [1]. Avoid the above compiler error by moving the 'struct page_frag_cache' to sched.h as suggested by Alexander, see [2]. 1. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956920@gmail.com/ 2. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=YM_aiA4OomD-2wXykO42bizaWMt_HOA@mail.gmail.com/ Suggested-by: Alexander Duyck Signed-off-by: Yunsheng Lin --- include/linux/mm_types_task.h | 18 ++++++++++++++++++ include/linux/page_frag_cache.h | 20 +------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/linux/mm_types_task.h b/include/linux/mm_types_task.h index a2f6179b672b..f2610112a642 100644 --- a/include/linux/mm_types_task.h +++ b/include/linux/mm_types_task.h @@ -8,6 +8,7 @@ * (These are defined separately to decouple sched.h from mm_types.h as much as possible.) */ +#include #include #include @@ -46,6 +47,23 @@ struct page_frag { #endif }; +#define PAGE_FRAG_CACHE_MAX_SIZE __ALIGN_MASK(32768, ~PAGE_MASK) +#define PAGE_FRAG_CACHE_MAX_ORDER get_order(PAGE_FRAG_CACHE_MAX_SIZE) +struct page_frag_cache { + /* encoded_va consists of the virtual address, pfmemalloc bit and order + * of a page. + */ + unsigned long encoded_va; + +#if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) && (BITS_PER_LONG <= 32) + __u16 remaining; + __u16 pagecnt_bias; +#else + __u32 remaining; + __u32 pagecnt_bias; +#endif +}; + /* Track pages that require TLB flushes */ struct tlbflush_unmap_batch { #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH diff --git a/include/linux/page_frag_cache.h b/include/linux/page_frag_cache.h index cd60e08f6d44..e0d65b57ac80 100644 --- a/include/linux/page_frag_cache.h +++ b/include/linux/page_frag_cache.h @@ -3,18 +3,15 @@ #ifndef _LINUX_PAGE_FRAG_CACHE_H #define _LINUX_PAGE_FRAG_CACHE_H -#include #include #include #include #include #include +#include #include #include -#define PAGE_FRAG_CACHE_MAX_SIZE __ALIGN_MASK(32768, ~PAGE_MASK) -#define PAGE_FRAG_CACHE_MAX_ORDER get_order(PAGE_FRAG_CACHE_MAX_SIZE) - #define PAGE_FRAG_CACHE_ORDER_MASK GENMASK(7, 0) #define PAGE_FRAG_CACHE_PFMEMALLOC_BIT BIT(8) #define PAGE_FRAG_CACHE_PFMEMALLOC_SHIFT 8 @@ -53,21 +50,6 @@ static inline void *encoded_page_address(unsigned long encoded_va) return (void *)(encoded_va & PAGE_MASK); } -struct page_frag_cache { - /* encoded_va consists of the virtual address, pfmemalloc bit and order - * of a page. - */ - unsigned long encoded_va; - -#if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) && (BITS_PER_LONG <= 32) - __u16 remaining; - __u16 pagecnt_bias; -#else - __u32 remaining; - __u32 pagecnt_bias; -#endif -}; - static inline void page_frag_cache_init(struct page_frag_cache *nc) { memset(nc, 0, sizeof(*nc));