diff mbox series

[net-next,v10,12/15] mm: page_frag: move 'struct page_frag_cache' to sched.h

Message ID 20240709132741.47751-13-linyunsheng@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Replace page_frag with page_frag_cache for sk_page_frag() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 676 this patch: 676
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/build_clang success Errors and warnings before: 1998 this patch: 1998
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16270 this patch: 16270
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 70 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yunsheng Lin July 9, 2024, 1:27 p.m. UTC
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(-)

Comments

Alexander Duyck July 9, 2024, 2:56 p.m. UTC | #1
On Tue, Jul 9, 2024 at 6:31 AM Yunsheng Lin <linyunsheng@huawei.com> wrote:
>
> 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].

Both the title and this description are misleading. You are moving it
to mm_types_task.h not sched.h.

Also I am pretty sure you could just fold this into your second patch
where you moved the code originally with just a tweak to the
description explaining the build dependency issue. No point in moving
the same structure twice within the same patch set.
diff mbox series

Patch

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));