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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4BDC43219 for ; Wed, 6 Apr 2022 00:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838203AbiDFAuj (ORCPT ); Tue, 5 Apr 2022 20:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573067AbiDERvM (ORCPT ); Tue, 5 Apr 2022 13:51:12 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE451D9EB8 for ; Tue, 5 Apr 2022 10:49:11 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id x20so7942422edi.12 for ; Tue, 05 Apr 2022 10:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RXCW1evSnb4oJ88sHTAFEYTq0HTuOW2ocRpwnA3InQ4=; b=DFediYf4lKdcEGd6wHnf3P2A1rH9d97LcubT3QP6yRNY6vUA82uDkOevPceh0sN/Wl AzNDVgFuK6V76WaqpSYAiG2hRF9Re4Ov3xlC/Ms7hpW9uCTQ7y898MEv8Ijbqhc6SxXo QvfpY4jywVuV6j8Ii/P3vkQXreEU44Hlqin6E5RTxZAap0ziUpyUXuD83coag22gB7nJ kP94eXAsBC1cr7hK8pVNGZaStSW21SliZd84A/wTh+8QK9KZdm23HHaRa8zC2IVlp4fq sk905jrtMt/I2FOoTaeCu/ArrkOR8UVb6SsiWhRhquLKZ90pI6vt79FBY7MRBMWLMUZ2 L8SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RXCW1evSnb4oJ88sHTAFEYTq0HTuOW2ocRpwnA3InQ4=; b=SsWYY3LHiAgB5n6iewp+EpnvTqRfWNMZ9c4ROH88N1VFQLWB3nF/hsCV6qAHH54j4+ QMW9MHMFW/cTyvHLvXy2BnLnl54Qvq6HM2WWeOUXAIlNxpaXlRQavgqmHf1dDj6KbUNB DVA2qkD03a3JfCRFfeYdzc7A5UwhpXuY/myKHECW/BOY4/1EXVTkRPgMgjpvUFBz5kU6 elIaYCy4qtsNUVVFBHev2DalV0gHS9wE7/ZvywMeritvPTmyBnbqNCqGUNdT7XE67Zyv Xf2Q+4TkitrJfGodRYNeExnTe/hN8G2+SYTqUE8ZCERkEGCZNEJS2M8KTZok3MPEBBHD ONgg== X-Gm-Message-State: AOAM531YXDNjjh1vDbhFIU4zskYmyaiPmAZJxIgERF9kwKmokd/M4ksh iBq1ClEsg1VR07Rf698wzt6QMmVgo3hUmlzZIY5+1w== X-Google-Smtp-Source: ABdhPJy3kLISS/qYYRzMDmjCuhPu7OU3AJeQfL+t2mEx7NkNwMYgXC85KD1rOoe+vR5iNyCwy95ZqCXnaDcme/ng0CI= X-Received: by 2002:aa7:d98f:0:b0:41c:bf0f:4c45 with SMTP id u15-20020aa7d98f000000b0041cbf0f4c45mr4818393eds.379.1649180950052; Tue, 05 Apr 2022 10:49:10 -0700 (PDT) MIME-Version: 1.0 References: <20220328035951.1817417-1-tjmercier@google.com> <20220328035951.1817417-6-tjmercier@google.com> <20220329152142.GA15794@blackbody.suse.cz> <20220405121245.GA30368@blackbody.suse.cz> In-Reply-To: <20220405121245.GA30368@blackbody.suse.cz> From: "T.J. Mercier" Date: Tue, 5 Apr 2022 10:48:58 -0700 Message-ID: Subject: Re: [RFC v4 5/8] dmabuf: Add gpu cgroup charge transfer function To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jonathan Corbet , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Hridya Valsaraju , Suren Baghdasaryan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Benjamin Gaignard , Liam Mark , Laura Abbott , Brian Starkey , John Stultz , Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan , Kalesh Singh , Kenny.Ho@amd.com, Shuah Khan , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 5, 2022 at 5:12 AM Michal Koutn=C3=BD wrote: > > On Fri, Apr 01, 2022 at 11:41:36AM -0700, "T.J. Mercier" wrote: > > This link doesn't work for me, but I think you're referring to the > > discussion about your "RAM_backed_buffers" comment from March 23rd. > > (Oops, it's a non-public message. But yes, you guessed it right ;-)) > > > Anyway the test I did goes like this: enable memcg and gpu cgoups > > tracking and run a process that allocates 100MiB of dmabufs. Observe > > memcg and gpu accounting values before and after the allocation. > > Thanks for this measurement/dem/demoo. > > > Before > > # cat memory.current gpu.memory.current > > 14909440 > > system 0 > > > > > > > > After > > # cat memory.current gpu.memory.current > > 48025600 > > system 104857600 > > > > So the memcg value increases by about 30 MiB while the gpu values > > increases by 100 MiB. > > > This is with kmem enabled, and the /proc/maps > > file for this process indicates that the majority of that 30 MiB is > > kernel memory. > > > I think this result shows that neither the kernel nor process memory > > overlap with the gpu cgroup tracking of these allocations. > > It depends how the semantics of the 'system' entry is defined, no? > As I grasped from other thread, the 'total' is going to be removed, so > 'system' represents exclusively device memory? > That's right. The system charges (soon to be renamed "system-heap") result only from an allocator (in this case the system heap) deciding to call gpucg_try_charge for the buffer which is entirely device memory. > > > So despite the fact that these buffers are in main memory, they are > > allocated in a way that does not result in memcg attribution. (It > > looks to me like __GFP_ACCOUNT is not set for these.) > > (I thought you knew what dmabufs your program used :-p) > I'm coming up to speed on a lot of new-to-me code here. :) Just for completeness, these buffers were allocated with libdmabufheap's AllocSystem. > So, the goal is to do the tracking and migrations only via the gpu cg > layer, regardless how memcg charges it (or not). > > (I have no opinion on that, I'm just summing it so that we're on the > same page.) > Yes, this reflects my intention and current state of the code in this serie= s. > Michal Thanks, T.J.