Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3978038imd; Mon, 29 Oct 2018 15:42:34 -0700 (PDT) X-Google-Smtp-Source: AJdET5eiK+q/OExjxiPeRUZYe434AIDwgnHgr7VmfijTNfST0wzkQu0Psfh7zGtg2g+dt/m21xsI X-Received: by 2002:a17:902:d882:: with SMTP id b2-v6mr6453266plz.207.1540852954755; Mon, 29 Oct 2018 15:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540852954; cv=none; d=google.com; s=arc-20160816; b=wIBYPPklobwrnTtw91dXOnCywOTvY4mmWQrsdG2Qs49ToEQFE7Q2I4qf+HLGNZDmJW 5kZe6+xFMQLTUKvCbunCrg+vQnBOoNzzgdK/pea6V8OFNM7tp5qTpkGfYsY260KtcE7I 62mYIQ6Gc3NDRu9O14P6RRxu+EMcnN5nZbA0sXVlnbwCdlCaYBi1Cul7i7/Dc7ZCLx0u bnBziw3DdUkJsT3IaoU/FiOoZs6grIHzgOoopGq0nsg5NNXOpQ7D6JHkhdTHSbo4YmuY 0WHO6wQPaMiHOVcFHEjYBzU04nSK/qRBdTU1rUnU6s9YloFBBNoD4mgEcfu8PGDkG/BB ck1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=78huRpW/8PWpaHQkOlIN4GoHC0jFZP3IteDziDOyjRg=; b=aXiPrTvH1GhKjGTCNHP/IZkJXYabbxRN7kNWzBWBBra0RX8LdAdfXv/UN144HIDVz9 93s4Cxti1ysznPGmOMQ/TyPo5MGApiLjkvQvMFOQ6QemC+5bNevd3oX78106awnA5wNX mpLM9CTWu3Cjbt+m1XwNqxCyojE6CLVdPnvUDl9Ks4oPKz/KbvD8gh7C3vvXbiTwJ7ny wLynYHOMDjVOCpnGb4AzVid+tZhQPxo3L0m3bBhPL8k8yN5DIIu1hnk8jbXS+30VRU/r IYDKE617QESdqd8dme7pjtqqOFaZWkGF3vNQkM0Hp210Zqm74nWm6w7llyZKR+m6gWzA QmMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13-v6si21274708pgv.84.2018.10.29.15.42.19; Mon, 29 Oct 2018 15:42:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729783AbeJ3Hcn (ORCPT + 99 others); Tue, 30 Oct 2018 03:32:43 -0400 Received: from shells.gnugeneration.com ([66.240.222.126]:59166 "EHLO shells.gnugeneration.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729771AbeJ3Hcn (ORCPT ); Tue, 30 Oct 2018 03:32:43 -0400 Received: by shells.gnugeneration.com (Postfix, from userid 1000) id CD4E31A402D8; Mon, 29 Oct 2018 15:41:58 -0700 (PDT) Date: Mon, 29 Oct 2018 15:41:58 -0700 From: Vito Caputo To: Waiman Long Cc: Davidlohr Bueso , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] fs/proc: introduce /proc/stat2 file Message-ID: <20181029224158.xqbj3i4fbmbjexlh@shells.gnugeneration.com> References: <20181029192521.23059-1-dave@stgolabs.net> <0afed890-7c5a-93ee-cdb9-e30775bd9cf1@redhat.com> <20181029200050.iejuxckzbm742dmw@linux-r8p5> <3c5ba85b-5114-c751-0114-ac2cb64c02ea@redhat.com> <20181029203818.pot26ewxbncfrnua@linux-r8p5> <20181029212314.nwruqg6au23ebqlu@shells.gnugeneration.com> <492f93c1-e062-f699-8c8c-c2277fd3fbb0@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <492f93c1-e062-f699-8c8c-c2277fd3fbb0@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 29, 2018 at 05:35:15PM -0400, Waiman Long wrote: > On 10/29/2018 05:23 PM, Vito Caputo wrote: > > On Mon, Oct 29, 2018 at 04:59:03PM -0400, Waiman Long wrote: > >> On 10/29/2018 04:38 PM, Davidlohr Bueso wrote: > >>> On Mon, 29 Oct 2018, Waiman Long wrote: > >>> > >>>> BTW, since you are making stat2 compatible with stat, will that be > >>>> easier from the user API perspective if we use a sysctl parameter to > >>>> turn on and off IRQs reporting for /proc/stat, for example? > >>> For one /proc/stat is also common for debugging envs (ie: performance) > >>> and I fear that if a tunnable modifies the behavior of the output, we > >>> it might never be usable again (at least not without having users also > >>> now consider the systctl parameter). Making it dynamic I think is not > >>> worth it. > >>> > >>> Thanks, > >>> Davidlohr > >> This is just a matter if it is easier for users to modify their code to > >> use /proc/stat2 or turning on a sysctl parameter. Again, this will > >> certainly depend on the circumstances. > >> > > I wonder if it makes sense to introduce a more general mechanism for > > toggling subfields in proc files. Extended attributes could probably be > > abused to key the subfields, write a 1 or 0 to well-known names for > > toggling them on a per-fd basis via fsetxattr. > > > > For this particular case the program would just have to add code like: > > > > int zero = 0; > > fsetxattr(proc_stat_fd, "intr", &zero, sizeof(zero), XATTR_REPLACE); > > > > Just putting it out there. I've certainly wanted an ability to noop > > fields before where I was polling proc frequently and skipping the bulk > > of what was there but syscpu was still rather high. > > > > I'm definitely not in favor of just adding another stat file that is the > > same format as the existing one with the intrs zeroed out. It's a dirty > > hack; fine for your local needs but too gross for upstream IMHO. > > > > Regards, > > Vito Caputo > > Does procfs allow extended attributes? I am not sure if using extended > attributes is a usual practice for doing this kind of control on a > procfs file. > I'm not aware of any such usage, but I didn't dig into the code to see if there were already conflicting xattr users. If this did turn out to be a reasonable approach, it would probably be wise to prefix the key strings with a namespace in case future uses come up. Like "filter:intr" or something along those lines. WRT procfs support for xattr, if it's not already implemented it's not difficult to add. The important factor is this utilizes an existing vfs api, there's nothing about procfs prohibiting xattr handling. Regards, Vito Caputo