Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1006849pxb; Wed, 6 Apr 2022 06:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw94lnJ60Uo66TOhoOhdd7zcdJi2XGG0EQINj0Hu4oAearQ52U0+djStopZPpZgfhilUGkh X-Received: by 2002:a63:cf4d:0:b0:399:40fc:addf with SMTP id b13-20020a63cf4d000000b0039940fcaddfmr7137079pgj.416.1649252041109; Wed, 06 Apr 2022 06:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649252041; cv=none; d=google.com; s=arc-20160816; b=HSTiUqxpLMl6e7RFbX/0fAX9ifo6p5YViZxCKkHNCrA5UkWhjqmWLgtxQ1Z2674f36 0ZSIm2vfsuCCz8ngznKr4FmK/Lb7UrnE1L5QhyFmfA73QcsibY9MCKr0xs3JZrC6Mq/B utawQSMOt9oMuNrrqO+NsM83ioExWxPl833Kfg8wK/yelRy4e19m+mrTYUDAUJ4dzGKi hB5B4kgkL3KUvHOBKAVtf/bxuaHsArTgOT1uBrovID3j6zGPVs9MvHUZp8kIOX/5Aiq3 O4yzORKTd4vrMZtYKUm54PZ4czWJM95qGY2MnAXQ/rW5sSIog0S4owYp3nGejuOUHWX7 fryw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RXCW1evSnb4oJ88sHTAFEYTq0HTuOW2ocRpwnA3InQ4=; b=c9x5uBwScIIiiBJ4QtrucF6qWLOXGODaW9QVZqnj5uHMVcZF1LGs/pwk6EGTirZjkF UYwmGQhAOVAsSpeZJ0ibi3ki4U47WxcJvXaSnfBiqq/+Vv9XjKzoZ/peLHQOuaNbHmSb zd5GwTUnv0DcSFYX8Jx6XRK7Ktjuc/2ufxqlxJgdiA0M3Xf74vIdl7I/+4btZ+aKQzq+ FsyCAurc5+LWQOFVZSyz1Y5146cvbbGJQSSt8NMXpEQOPzmkozCbwPMMSbQAsJPGLljY 4PxwGYfXNna6lm8lTCWdrBM6PssMqLx4C+2F413UweHfAxXBwsnvuaWcYnKU1ECS450A p1qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DFediYf4; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id me2-20020a17090b17c200b001bd3fc48d31si5281734pjb.43.2022.04.06.06.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:34:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DFediYf4; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90E7453A7A7; Wed, 6 Apr 2022 04:13:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838197AbiDFAuh (ORCPT + 99 others); Tue, 5 Apr 2022 20:50:37 -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-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 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.