Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

From: Peter Zijlstra
Date: Thu Oct 01 2020 - 10:23:44 EST


On Thu, Oct 01, 2020 at 06:49:36AM -0700, Dave Hansen wrote:
> On 9/30/20 10:30 AM, Peter Zijlstra wrote:
> > In general though; I think using ->active_mm is a mistake though. That
> > code should be doing something like:
> >
> >
> > mm = current->mm;
> > if (!mm)
> > mm = &init_mm;
> >
>
> I was hoping that using ->active_mm would give us the *actual* copy of
> the page tables that's loaded in CR3 for kernel thraeds. But, there are
> few if any practical advantages of doing that at the moment.

Some of us hate active_mm with a passion and want to remove it entirely
(/me waves at amluto).

Also, if !current->mm, it had better not be accessing anything outside
of the kernel map, so &init_mm should cover that just fine. And given
the kernel maps are shared between all CR3s, they'll see the exact same
pagetables.