From: Yunsheng Lin <yunshenglin0825@gmail.com>
To: Alexander Duyck <alexander.duyck@gmail.com>,
Yunsheng Lin <linyunsheng@huawei.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Subject: Re: [PATCH net-next v9 10/13] mm: page_frag: introduce prepare/probe/commit API
Date: Sun, 30 Jun 2024 22:05:01 +0800 [thread overview]
Message-ID: <0a80e362-1eb7-40b0-b1b9-07ec5a6506ea@gmail.com> (raw)
In-Reply-To: <CAKgT0Ueg1u2S5LJuo0Ecs9dAPPDujtJ0GLcm8BTsfDx9LpJZVg@mail.gmail.com>
On 6/30/2024 1:37 AM, Alexander Duyck wrote:
> On Sat, Jun 29, 2024 at 4:15 AM Yunsheng Lin <linyunsheng@huawei.com> wrote:
...
>>>
>>> Why is this a macro instead of just being an inline? Are you trying to
>>> avoid having to include a header due to the virt_to_page?
>>
>> Yes, you are right.
>> I tried including different headers for virt_to_page(), and it did not
>> work for arch/x86/kernel/asm-offsets.s, which has included linux/sched.h,
>> and linux/sched.h need 'struct page_frag_cache' for 'struct task_struct'
>> after this patchset, including page_frag_cache.h for sched.h causes the
>> below compiler error:
>>
>> CC arch/x86/kernel/asm-offsets.s
>> In file included from ./arch/x86/include/asm/page.h:89,
>> from ./arch/x86/include/asm/thread_info.h:12,
>> from ./include/linux/thread_info.h:60,
>> from ./include/linux/spinlock.h:60,
>> from ./include/linux/swait.h:7,
>> from ./include/linux/completion.h:12,
>> from ./include/linux/crypto.h:15,
>> from arch/x86/kernel/asm-offsets.c:9:
>> ./include/linux/page_frag_cache.h: In function ‘page_frag_alloc_align’:
>> ./include/asm-generic/memory_model.h:37:34: error: ‘vmemmap’ undeclared (first use in this function); did you mean ‘mem_map’?
>> 37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
>> | ^~~~~~~
>> ./include/asm-generic/memory_model.h:65:21: note: in expansion of macro ‘__pfn_to_page’
>> 65 | #define pfn_to_page __pfn_to_page
>> | ^~~~~~~~~~~~~
>> ./arch/x86/include/asm/page.h:68:33: note: in expansion of macro ‘pfn_to_page’
>> 68 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
>> | ^~~~~~~~~~~
>> ./include/linux/page_frag_cache.h:151:16: note: in expansion of macro ‘virt_to_page’
>> 151 | return virt_to_page(va);
>> | ^~~~~~~~~~~~
>> ./include/asm-generic/memory_model.h:37:34: note: each undeclared identifier is reported only once for each function it appears in
>> 37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
>> | ^~~~~~~
>> ./include/asm-generic/memory_model.h:65:21: note: in expansion of macro ‘__pfn_to_page’
>> 65 | #define pfn_to_page __pfn_to_page
>> | ^~~~~~~~~~~~~
>> ./arch/x86/include/asm/page.h:68:33: note: in expansion of macro ‘pfn_to_page’
>> 68 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
>> | ^~~~~~~~~~~
>> ./include/linux/page_frag_cache.h:151:16: note: in expansion of macro ‘virt_to_page’
>> 151 | return virt_to_page(va);
>>
>>
>
> I am pretty sure you just need to add:
> #include <asm/page.h>
I am supposing you mean adding the above to page_frag_cache.h, right?
It seems thing is more complicated for SPARSEMEM_VMEMMAP case, as it
needs the declaration of 'vmemmap'(some arch defines it as a pointer
variable while some arch defines it as a macro) and the definition of
'struct page' for '(vmemmap + (pfn))' operation.
Adding below for 'vmemmap' and 'struct page' seems to have some compiler
error caused by interdependence between linux/mm_types.h and asm/pgtable.h:
#include <asm/pgtable.h>
#include <linux/mm_types.h>
As below, asm/pgtable.h obviously need the definition of 'struct
mm_struct' from linux/mm_types.h, and linux/mm_types.h has some
a long dependency of asm/pgtable.h starting from linux/uprobes.h
if we add '#include <asm/pgtable.h>' in linux/page_frag_cache.h:
In file included from ./include/linux/page_frag_cache.h:8,
from ./include/linux/sched.h:49,
from ./include/linux/percpu.h:13,
from ./arch/x86/include/asm/msr.h:15,
from ./arch/x86/include/asm/tsc.h:10,
from ./arch/x86/include/asm/timex.h:6,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/jiffies.h:10,
from ./include/linux/ktime.h:25,
from ./include/linux/timer.h:6,
from ./include/linux/workqueue.h:9,
from ./include/linux/srcu.h:21,
from ./include/linux/notifier.h:16,
from ./arch/x86/include/asm/uprobes.h:13,
from ./include/linux/uprobes.h:49,
from ./include/linux/mm_types.h:16,
from ./include/linux/mmzone.h:22,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:16,
from ./include/linux/crypto.h:17,
from arch/x86/kernel/asm-offsets.c:9:
./arch/x86/include/asm/pgtable.h: In function ‘pte_accessible’:
./arch/x86/include/asm/pgtable.h:970:40: error: invalid use of undefined
type ‘struct mm_struct’
970 | atomic_read(&mm->tlb_flush_pending))
| ^~
./arch/x86/include/asm/pgtable.h: In function ‘pmdp_establish’:
./arch/x86/include/asm/pgtable.h:1370:37: error: invalid use of
undefined type ‘struct vm_area_struct’
1370 | page_table_check_pmd_set(vma->vm_mm, pmdp, pmd);
| ^~
./arch/x86/include/asm/pgtable.h: At top level:
./arch/x86/include/asm/pgtable.h:1495:50: error: ‘struct vm_fault’
declared inside parameter list will not be visible outside of this
definition or declaration [-Werror]
1495 | static inline void update_mmu_cache_range(struct vm_fault *vmf,
| ^~~~~~~~
In file included from ./arch/x86/include/asm/page.h:89,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:60,
from ./include/linux/spinlock.h:60,
from ./include/linux/swait.h:7,
from ./include/linux/completion.h:12,
from ./include/linux/crypto.h:15,
from arch/x86/kernel/asm-offsets.c:9:
./include/linux/page_frag_cache.h: In function ‘page_frag_alloc_probe’:
./include/asm-generic/memory_model.h:37:42: error: invalid use of
undefined type ‘struct page’
37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
| ^
./include/asm-generic/memory_model.h:65:21: note: in expansion of macro
‘__pfn_to_page’
65 | #define pfn_to_page __pfn_to_page
| ^~~~~~~~~~~~~
./arch/x86/include/asm/page.h:68:33: note: in expansion of macro
‘pfn_to_page’
68 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >>
PAGE_SHIFT)
| ^~~~~~~~~~~
./include/linux/page_frag_cache.h:225:16: note: in expansion of macro
‘virt_to_page’
225 | return virt_to_page(encoded_va);
| ^~~~~~~~~~~~
cc1: all warnings being treated as errors
>
next prev parent reply other threads:[~2024-06-30 14:05 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 13:52 [PATCH net-next v9 00/13] First try to replace page_frag with page_frag_cache Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 01/13] mm: page_frag: add a test module for page_frag Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 02/13] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-07-01 23:10 ` Alexander H Duyck
2024-07-02 12:27 ` Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 03/13] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-07-01 23:27 ` Alexander H Duyck
2024-07-02 12:28 ` Yunsheng Lin
2024-07-02 16:00 ` Alexander Duyck
2024-07-03 11:25 ` Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 04/13] mm: page_frag: add '_va' suffix to page_frag API Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 05/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 06/13] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-07-02 0:08 ` Alexander H Duyck
2024-07-02 12:35 ` Yunsheng Lin
2024-07-02 14:55 ` Alexander H Duyck
2024-07-03 12:33 ` Yunsheng Lin
2024-07-10 15:28 ` Alexander H Duyck
2024-07-11 8:16 ` Yunsheng Lin
2024-07-11 16:49 ` Alexander Duyck
2024-07-12 8:42 ` Yunsheng Lin
2024-07-12 16:55 ` Alexander Duyck
2024-07-13 5:20 ` Yunsheng Lin
2024-07-13 16:55 ` Alexander Duyck
2024-07-14 4:52 ` Yunsheng Lin
2024-07-15 17:55 ` Alexander Duyck
2024-07-16 12:58 ` Yunsheng Lin
2024-07-17 12:31 ` Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 07/13] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-07-02 15:30 ` Alexander H Duyck
2024-07-03 12:36 ` Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 08/13] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 09/13] net: introduce the skb_copy_to_va_nocache() helper Yunsheng Lin
2024-07-02 15:52 ` Alexander H Duyck
2024-07-03 12:36 ` Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 10/13] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-06-28 22:35 ` Alexander H Duyck
2024-06-29 11:15 ` Yunsheng Lin
2024-06-29 17:37 ` Alexander Duyck
2024-06-30 14:05 ` Yunsheng Lin [this message]
2024-06-30 14:35 ` Alexander Duyck
2024-06-30 15:05 ` Yunsheng Lin
2024-07-03 12:40 ` Yunsheng Lin
2024-07-07 17:12 ` Alexander Duyck
2024-07-08 10:58 ` Yunsheng Lin
2024-07-08 14:30 ` Alexander Duyck
2024-07-09 6:57 ` Yunsheng Lin
2024-07-09 13:40 ` Alexander Duyck
2024-06-25 13:52 ` [PATCH net-next v9 11/13] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 12/13] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-06-25 13:52 ` [PATCH net-next v9 13/13] mm: page_frag: add a entry in MAINTAINERS " Yunsheng Lin
2024-06-25 23:27 ` [PATCH net-next v9 00/13] First try to replace page_frag with page_frag_cache Jakub Kicinski
2024-06-25 23:41 ` Alexander Duyck
2024-06-26 12:16 ` Yunsheng Lin
2024-06-26 17:12 ` Andrew Lunn
2024-06-27 11:16 ` Yunsheng Lin
2024-06-27 19:58 ` Jakub Kicinski
2024-06-29 11:14 ` 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=0a80e362-1eb7-40b0-b1b9-07ec5a6506ea@gmail.com \
--to=yunshenglin0825@gmail.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=linyunsheng@huawei.com \
--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