From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7CB6C433B4 for ; Wed, 19 May 2021 16:16:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FE5861244 for ; Wed, 19 May 2021 16:16:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FE5861244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D89F6EE0F; Wed, 19 May 2021 16:16:15 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD8596EE0F; Wed, 19 May 2021 16:16:13 +0000 (UTC) IronPort-SDR: D2VT0kvJyrZ58R1WX+Yz7w5bHuO8Xa+UB0XTxYM6ZgXp1pN+4KybWYowTYsoDXdSATJCq7JGEJ nLFc+Krvt8LQ== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="201063318" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="201063318" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 09:16:07 -0700 IronPort-SDR: QJO5a5py9Yij6FH11k4P+DQndNdJBbOrgAAprs2MeXjWyX+1bSML/jOYEnMsoSSf/ABysqF1mY +wMZLjUnUNDw== X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="544620966" Received: from leiderma-mobl1.ger.corp.intel.com (HELO [10.213.194.66]) ([10.213.194.66]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 09:16:05 -0700 From: Tvrtko Ursulin To: Daniel Stone References: <6cf2f14a-6a16-5ea3-d307-004faad4cc79@linux.intel.com> <7f8fc38a-cd25-aa1f-fa2d-5d3334edb3d2@linux.intel.com> <71428a10-4b2f-dbbf-7678-7487f9eda6a5@linux.intel.com> Organization: Intel Corporation UK Plc Message-ID: Date: Wed, 19 May 2021 17:16:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <71428a10-4b2f-dbbf-7678-7487f9eda6a5@linux.intel.com> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 0/7] Per client engine busyness X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "jhubbard@nvidia.com" , "nouveau@lists.freedesktop.org" , Intel Graphics Development , Maling list - DRI developers , Simon Ser , "Koenig, Christian" , "aritger@nvidia.com" , "Nieto, David M" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 18/05/2021 10:40, Tvrtko Ursulin wrote: > > On 18/05/2021 10:16, Daniel Stone wrote: >> Hi, >> >> On Tue, 18 May 2021 at 10:09, Tvrtko Ursulin >> wrote: >>> I was just wondering if stat(2) and a chrdev major check would be a >>> solid criteria to more efficiently (compared to parsing the text >>> content) detect drm files while walking procfs. >> >> Maybe I'm missing something, but is the per-PID walk actually a >> measurable performance issue rather than just a bit unpleasant? > > Per pid and per each open fd. > > As said in the other thread what bothers me a bit in this scheme is that > the cost of obtaining GPU usage scales based on non-GPU criteria. > > For use case of a top-like tool which shows all processes this is a > smaller additional cost, but then for a gpu-top like tool it is somewhat > higher. To further expand, not only cost would scale per pid multiplies per open fd, but to detect which of the fds are DRM I see these three options: 1) Open and parse fdinfo. 2) Name based matching ie /dev/dri/.. something. 3) Stat the symlink target and check for DRM major. All sound quite sub-optimal to me. Name based matching is probably the least evil on system resource usage (Keeping the dentry cache too hot? Too many syscalls?), even though fundamentally I don't it is the right approach. What happens with dup(2) is another question. Does anyone have any feedback on the /proc//gpu idea at all? Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx