Re: [PATCH v2 6/6] dax: add tracepoints to dax_pmd_insert_mapping()

From: Ross Zwisler
Date: Thu Dec 01 2016 - 10:44:39 EST


On Thu, Dec 01, 2016 at 09:19:30AM -0500, Steven Rostedt wrote:
> On Wed, 30 Nov 2016 16:45:33 -0700
> Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> wrote:
>
> > diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h
> > index a3d90b9..033fc7b 100644
> > --- a/include/linux/pfn_t.h
> > +++ b/include/linux/pfn_t.h
> > @@ -15,6 +15,12 @@
> > #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
> > #define PFN_MAP (1ULL << (BITS_PER_LONG_LONG - 4))
> >
> > +#define PFN_FLAGS_TRACE \
> > + { PFN_SG_CHAIN, "SG_CHAIN" }, \
> > + { PFN_SG_LAST, "SG_LAST" }, \
> > + { PFN_DEV, "DEV" }, \
> > + { PFN_MAP, "MAP" }
> > +
> > static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, u64 flags)
> > {
> > pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), };
> > diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
> > index 9f0a455..7d0ea33 100644
> > --- a/include/trace/events/fs_dax.h
> > +++ b/include/trace/events/fs_dax.h
> > @@ -104,6 +104,57 @@ DEFINE_EVENT(dax_pmd_load_hole_class, name, \
> > DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole);
> > DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback);
> >
> > +DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
> > + TP_PROTO(struct inode *inode, struct vm_area_struct *vma,
> > + unsigned long address, int write, long length, pfn_t pfn,
> > + void *radix_entry),
> > + TP_ARGS(inode, vma, address, write, length, pfn, radix_entry),
> > + TP_STRUCT__entry(
> > + __field(dev_t, dev)
> > + __field(unsigned long, ino)
> > + __field(unsigned long, vm_flags)
> > + __field(unsigned long, address)
> > + __field(int, write)
>
> Place "write" at the end. The ring buffer is 4 byte aligned, so on
> archs that can access 8 bytes on 4 byte alignment, this will be packed
> tighter. Otherwise, you'll get 4 empty bytes after "write".

Actually I think it may be ideal to stick it as the 2nd entry after 'dev'.
dev_t is:

typedef __u32 __kernel_dev_t;
typedef __kernel_dev_t dev_t;

So those two 32 bit values should combine into a single 64 bit space.

Thanks for the help, I obviously wasn't considering packing when ordering the
elements.