From: Yunsheng Lin <linyunsheng@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Yunsheng Lin <linyunsheng@huawei.com>,
Alexander Duyck <alexander.duyck@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>
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 [thread overview]
Message-ID: <20240709132741.47751-13-linyunsheng@huawei.com> (raw)
In-Reply-To: <20240709132741.47751-1-linyunsheng@huawei.com>
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 <alexander.duyck@gmail.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
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 <linux/align.h>
#include <linux/types.h>
#include <asm/page.h>
@@ -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 <linux/align.h>
#include <linux/bits.h>
#include <linux/build_bug.h>
#include <linux/log2.h>
#include <linux/types.h>
#include <linux/mm.h>
+#include <linux/mm_types_task.h>
#include <linux/mmdebug.h>
#include <asm/page.h>
-#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));
--
2.33.0
next prev parent reply other threads:[~2024-07-09 13:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240709132741.47751-1-linyunsheng@huawei.com>
2024-07-09 13:27 ` [PATCH net-next v10 01/15] mm: page_frag: add a test module for page_frag Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 02/15] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 03/15] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 04/15] mm: page_frag: add '_va' suffix to page_frag API Yunsheng Lin
2024-07-10 11:13 ` [EXTERNAL] " Subbaraya Sundeep Bhatta
2024-07-09 13:27 ` [PATCH net-next v10 05/15] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 07/15] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 08/15] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 09/15] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-07-09 13:27 ` [PATCH net-next v10 11/15] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-07-09 13:27 ` Yunsheng Lin [this message]
2024-07-09 14:56 ` [PATCH net-next v10 12/15] mm: page_frag: move 'struct page_frag_cache' to sched.h Alexander Duyck
2024-07-09 13:27 ` [PATCH net-next v10 14/15] mm: page_frag: update documentation for page_frag Yunsheng Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240709132741.47751-13-linyunsheng@huawei.com \
--to=linyunsheng@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox