From owner-freebsd-current@FreeBSD.ORG Sat Jan 31 15:36:32 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4E6BD9F for ; Sat, 31 Jan 2015 15:36:32 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37EC89C6 for ; Sat, 31 Jan 2015 15:36:32 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t0VFaLhn048295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 31 Jan 2015 17:36:21 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t0VFaLhn048295 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t0VFaLss048294; Sat, 31 Jan 2015 17:36:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 31 Jan 2015 17:36:21 +0200 From: Konstantin Belousov To: Eric Badger Subject: Re: Filepaths in VM map for tmpfs files Message-ID: <20150131153621.GH42409@kib.kiev.ua> References: <54CCEFAB.9040406@badgerio.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54CCEFAB.9040406@badgerio.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2015 15:36:32 -0000 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 ?