Date: Sat, 31 Jan 2015 17:36:21 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Eric Badger <eric@badgerio.us> Cc: freebsd-current@freebsd.org Subject: Re: Filepaths in VM map for tmpfs files Message-ID: <20150131153621.GH42409@kib.kiev.ua> In-Reply-To: <54CCEFAB.9040406@badgerio.us> References: <54CCEFAB.9040406@badgerio.us>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 31, 2015 at 09:07:23AM -0600, Eric Badger wrote: > In FreeBSD 9, examining the VM map of a process (with e.g. 'procstat > -v') with a tmpfs file mapped showed a VNODE type and displayed the file > path. In 10.0 up to CURRENT (I believe this started at r250030), instead > SWAP is shown without a filepath. > > This has some unfortunate consequences; I discovered this problem when > trying to use dtrace's pid provider, which fails to find symbols for > executables running from tmpfs. > > I've attached a patch which will repair procstat/dtrace. There are a few > other places such a patch would be needed. I'm willing to put together > such a patch, but would like to first hear some feedback that this seems > like a reasonable approach, or if there's anything I've missed. > > Thoughts? > > Eric > > > Index: sys/kern/kern_proc.c > =================================================================== > --- sys/kern/kern_proc.c (revision 277957) > +++ sys/kern/kern_proc.c (working copy) > @@ -2337,6 +2337,11 @@ > break; > case OBJT_SWAP: > kve->kve_type = KVME_TYPE_SWAP; > + if ((lobj->flags & OBJ_TMPFS) != 0) > + { > + vp = lobj->un_pager.swp.swp_tmpfs; > + vref(vp); > + } > break; > case OBJT_DEVICE: > kve->kve_type = KVME_TYPE_DEVICE; First, shouldn't the kve_type changed to KVME_TYPE_VNODE as well ? Second, note that it is possible that the vnode is recycled, so OBJ_TMPFS flag is cleared for tmpfs swap object. The OBJ_TMPFS_NODE flag is still set then. I am not sure what to do in this case, should the type changed to KVME_TYPE_VNODE still, but kve_vn_* fields left invalid ?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150131153621.GH42409>