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=-0.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 1221EC433ED for ; Tue, 20 Apr 2021 14:49:12 +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 96A0B613CE for ; Tue, 20 Apr 2021 14:49:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96A0B613CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fooishbar.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC2EE88E95; Tue, 20 Apr 2021 14:49:10 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BFCB88E95 for ; Tue, 20 Apr 2021 14:49:10 +0000 (UTC) Received: by mail-wr1-x436.google.com with SMTP id h4so28871467wrt.12 for ; Tue, 20 Apr 2021 07:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fooishbar-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cdVh8MgJ3hW4eH9NelsGjOWmRUKen6Ny2zYwNZtusm0=; b=iXvgXWk1pXVxRnSGMDD02neg24RzJJaPmnbrglH49tCCTXQLx9iSVPkXYnhfJUsZ63 s6/Gp/FnyJxORaV7nbpBWyQnUIXNelzDW/lIr6wXf8dUHSgQUdgAEAf9t3qTdBOzThPt 0QHr85nCS5abEfAiQv1TOpoY9yMYi5l3ml4JzUnaURpMaiYX3LP25Ps51ZHQ6MdmVx9h Fogzvz/F3fic5Sj/PO6YIFNJDYbF0vL4dyjduoRch0Wc4ivWP7MAk3zK6sG8hufW3Pzf SdWCIqRYhLxJQgKLHHaA6/eZLZwCqhgT1gErr9UzK1N71mxAoIvG33e5bllM4oaGeheU JGdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cdVh8MgJ3hW4eH9NelsGjOWmRUKen6Ny2zYwNZtusm0=; b=MXksqRH/yuVWkLhAVZvMng+V6xDdK/0mqzTpHzEsqXCIYGusEVl902SGfL/qEmoKly whoBkSl3F7Z1LSswYeZWpvpgCf3xHjRwBH4WBZJs3UXQKTDL3ViHDVPwskIXy2C3jF/i Zoc6gNRCoSu7ccwrE3F+bDFVEp1FNa2Aa2eCps6HA7aoT5m3TF5t2CwiA2vUCKkbavRI RKzjBzTOxBbn6i76wg25NFoV88AIiY4xNF9atoyr8Jrkm3+N7jCX27sbWIu5/XOEiAgF Nbi5mi6RUGl5wGKl1zPGkwWcg0s6LHDNL3q55ptGv7X2H3p3hFYMeNGwHEq5YGwibL7z TdEA== X-Gm-Message-State: AOAM532Qtge9spyboA2f1TxFndj/Wzfqo6cuOGG1aOwUAzPtQZPx/4Hf viKIQlZYFP7TGKvu0+cjntOrICyCtEFljInl0+YwOw== X-Google-Smtp-Source: ABdhPJzE4R91MpVGkN6iAOo5Axe07ZxsvgnvjbpeOJkCKLR5/LAD17zPHniT6BPdeCwP2Y05zVvzi7vUeydgGNH/YA8= X-Received: by 2002:adf:eb0a:: with SMTP id s10mr21372540wrn.6.1618930148537; Tue, 20 Apr 2021 07:49:08 -0700 (PDT) MIME-Version: 1.0 References: <20210416123352.10747-1-peter.enderborg@sony.com> <9d4b7f7d-1a7d-0899-bf33-49fac1847bbe@sony.com> In-Reply-To: <9d4b7f7d-1a7d-0899-bf33-49fac1847bbe@sony.com> From: Daniel Stone Date: Tue, 20 Apr 2021 15:48:21 +0100 Message-ID: Subject: Re: [PATCH v2] dma-buf: Add DmaBufTotal counter in meminfo To: Peter Enderborg X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Matthew Wilcox , NeilBrown , Linux Kernel Mailing List , dri-devel , Alexey Dobriyan , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Shakeel Butt , Mike Rapoport , Sami Tolvanen , Muchun Song , linux-fsdevel@vger.kernel.org, Andrew Morton , =?UTF-8?Q?Christian_K=C3=B6nig?= , Roman Gushchin , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: multipart/mixed; boundary="===============1599874911==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1599874911== Content-Type: multipart/alternative; boundary="0000000000006b8c7805c0688c24" --0000000000006b8c7805c0688c24 Content-Type: text/plain; charset="UTF-8" On Tue, 20 Apr 2021 at 14:46, wrote: > On 4/20/21 3:34 PM, Daniel Stone wrote: > > On Fri, 16 Apr 2021 at 13:34, Peter Enderborg > wrote: > > This adds a total used dma-buf memory. Details > > can be found in debugfs, however it is not for everyone > > and not always available. dma-buf are indirect allocated by > > userspace. So with this value we can monitor and detect > > userspace applications that have problems. > > > > > > FWIW, this won't work super well for Android where gralloc is > implemented as a system service, so all graphics usage will instantly be > accounted to it. > > This resource allocation is a big part of why we need it. Why should it > not work? > Sorry, I'd somehow completely misread that as being locally rather than globally accounted. Given that, it's more correct, just also not super useful. Some drivers export allocation tracepoints which you could use if you have a decent userspace tracing infrastructure. Short of that, many drivers export this kind of thing through debugfs already. I think a better long-term direction is probably getting accounting from dma-heaps rather than extending core dmabuf itself. Cheers, Daniel --0000000000006b8c7805c0688c24 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 20 Apr 2021 at 1= 4:46, <Peter.Enderborg@sony.= com> wrote:
On 4/20/21 3:34 PM, Daniel Stone wrote= :
> On Fri, 16 Apr 2021 at 13:34, Peter Enderborg <peter.enderborg@sony.com= <mailto:p= eter.enderborg@sony.com>> wrote:
>=C2=A0 =C2=A0 =C2=A0This = adds a total used dma-buf memory. Details
>=C2=A0 =C2=A0 =C2=A0can be found in debugfs, however it is not for ever= yone
>=C2=A0 =C2=A0 =C2=A0and not always available. dma-buf are indirect allo= cated by
>=C2=A0 =C2=A0 =C2=A0userspace. So with this value we can monitor and de= tect
>=C2=A0 =C2=A0 =C2=A0userspace applications that have problems.
>
>
> FWIW, this won't work super well for Android where gralloc is impl= emented as a system service, so all graphics usage will instantly be accoun= ted to it.

This resource allocation is a big part of why we need it. Why should it not= work?

Sorry, I'd somehow completel= y misread that as being locally rather than globally accounted. Given that,= it's more correct, just also not super useful.

Some drivers export allocation= tracepoints which you could use if you have a decent userspace tracing inf= rastructure. Short of that, many drivers export this kind of thing through = debugfs already. I think a better long-term direction is probably getting a= ccounting from dma-heaps rather than extending core dmabuf itself.

Cheers,
Daniel=C2=A0
--0000000000006b8c7805c0688c24-- --===============1599874911== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1599874911==--