I'll follow that approach.

On Fri, Mar 10, 2023, at 12:02 PM, Steven Rostedt wrote:
On Fri, 10 Mar 2023 11:22:54 -0800
Stefan Roesch <shr@devkernel.io> wrote:

> >> + trace_ksm_remove_rmap_item(stable_node->kpfn, rmap_item, rmap_item->mm);  
> >
> > Instead of dereferencing the stable_node here, where the work could
> > possibly happen outside the trace event and in the hot path, could you pass
> > in the stable_node instead, and then in the TP_fast_assign() do:
> >
> > __entry->pfn = stable_node->kpfn;
> >
> >  

> To do this, the structure would need to be exposed. Currently the
> structure is defined in ksm.c. This is an internal structure that we
> most likely don't want to expose. We can get by not printing the pfn
> and use the rmap_item to refer back to it, but exposing it directly
> here is more convenient for debugging.

> Any thoughts?

Sounds like the include/trace/events/ksm.h should be local too.

See my reply about include/trace/events/thermal.h

  https://lore.kernel.org/all/20230227100715.7d896836@gandalf.local.home/

And their solution.

  https://lore.kernel.org/all/20230307133735.90772-2-daniel.lezcano@linaro.org/

I suggest you do the same.

-- Steve