Re: [PATCH 00/29] Speculative page faults (anon vmas only)
From: Michel Lespinasse
Date: Mon Jun 14 2021 - 03:04:44 EST
On Thu, May 20, 2021 at 03:10:24PM -0700, Suren Baghdasaryan wrote:
> Hi Paul,
> I promised you to look into this but somehow forgot to reply, sorry
> about that. The issue is the new "#include <linux/mm_types.h>" in mm.h
> which causes page_pgdat() usage before it is defined:
Yes. This only happens in non-memcg configs, which is why I hadn't
found it in testing.
>
> mm.h includes mm_types.h
> mm_types.h includes vmstat.h
> vmstat.h uses page_pgdat()
> mm.h defines page_pgdat()
>
> Not sure if this is the best way to fix it but this worked fine for me:
>
> ---
> include/linux/mmap_lock.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
> index 98f24a9910a9..13d4a706c0eb 100644
> --- a/include/linux/mmap_lock.h
> +++ b/include/linux/mmap_lock.h
> @@ -7,7 +7,7 @@
> #include <linux/rwsem.h>
> #include <linux/tracepoint-defs.h>
> #include <linux/types.h>
> -#include <linux/vmstat.h>
> +#include <linux/vm_event_item.h>
>
> #ifdef CONFIG_SPECULATIVE_PAGE_FAULT
> #define MMAP_LOCK_SEQ_INITIALIZER(name) \
> @@ -113,6 +113,8 @@ static inline bool __mmap_seq_read_check(struct
> mm_struct *mm,
> }
>
> #ifdef CONFIG_SPECULATIVE_PAGE_FAULT_STATS
> +static inline void count_vm_event(enum vm_event_item item);
> +
> static inline bool mmap_seq_read_check(struct mm_struct *mm, unsigned long seq,
> enum vm_event_item fail_event)
> {
I think having only the count_vm_event() prototype may cause it to not
actually get inlined when we want it ?
I think it would be ideal to have a separate linux/vm_event.h header,
with just the definitions that are currently in linux/vmstat.h
between "#ifdef CONFIG_VM_EVENT_COUNTERS" and up to (and including)
the __count_vm_events() definition (i.e., functions that just increment
the percpu event counters). Then mmap_lock.h could use that instead of
the full vmstat.h.
--
Michel "walken" Lespinasse