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 DFF53C4332F for ; Tue, 22 Mar 2022 16:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239281AbiCVQto (ORCPT ); Tue, 22 Mar 2022 12:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239270AbiCVQtl (ORCPT ); Tue, 22 Mar 2022 12:49:41 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF01DF66 for ; Tue, 22 Mar 2022 09:48:12 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id c62so2892964edf.5 for ; Tue, 22 Mar 2022 09:48:12 -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=AGjZE0nexYYIrgZGc1/sQ9ebvM2IDXrU/8dxpFIfC6Q=; b=no3QyBMN97jJJhzD7cqUG00A6e2MB7KJHQvzy4ZBrorfKhZnY4KLpmH2ijl3hqJAEq w38SA1GGvBFZG7tP/8djpuj0BUbYdHZD9uy+WcRz+GY1qJugW+aRKiIkcr9+/i+/yCpl oDvJjvDBQlBi/23CI8I3sggW1bURzFDHhLeDItamtogT9SNEeMCBJHoKiJqhx70tbNX1 Ju5tti5nJ1ezrJNTsClfOUV4Il9mdQ1cxiJnaMVkNSqyhptqkuN9M3Rj6KebwW+655E+ EwOjKo25LrOTYBbCto5RaMfNuEZ99/RUyctw5hM2x3wHWiu5Zwfr1NE2y290i/E2Ow60 0gfg== 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=AGjZE0nexYYIrgZGc1/sQ9ebvM2IDXrU/8dxpFIfC6Q=; b=6luiIU0gGN3QR7IA3fLoAVnDZtQ+30956oiUlQZetIFYzn3fIaIpsQj9YtxJzOVjYx thVh7r7Sz2GdLO08VI+njiz9nGXfksP8JXYMUdFHG7WXyK4p9eR2oHEBj6lbnsPR64KK f6v6NHKbMC0LOzf3ptdsl13n7cjCKt9pXSctbOigkLY6hnyW3POYfAuG5wa1/PVU0t32 YNZVob7r/BE82CC0V1yQDWqVlaxKwvosfO32EM7rM+9t2AVEU3b/YtJMa4lPzaaSfu2e LpMtNiqbV74LnEULQLARdveTjgL2DenefMMKm3V0yYsaAhergcYvJ4EAbhwf8QBPlR4G Sk2A== X-Gm-Message-State: AOAM532LljXrGEodD0CvO8R+aKTjLd0YmuB4fEbEbu3bwpu8fzNVeWGM 3JjKU7XJ3AE34ZqGIcHxpzuxndOa6ef98vVLhRlUQQ== X-Google-Smtp-Source: ABdhPJwZRYX6C1CGVh68tu7TSeAiEpJ8wx/fcfVLk5Q+CMQBUqipxTaYyzGYpgmBcf1ERpmMdJvRS+InEGnYxa4P70w= X-Received: by 2002:a50:fe81:0:b0:419:16a5:d265 with SMTP id d1-20020a50fe81000000b0041916a5d265mr21254515edt.4.1647967691267; Tue, 22 Mar 2022 09:48:11 -0700 (PDT) MIME-Version: 1.0 References: <20220322095223.GG8477@blackbody.suse.cz> In-Reply-To: <20220322095223.GG8477@blackbody.suse.cz> From: "T.J. Mercier" Date: Tue, 22 Mar 2022 09:47:59 -0700 Message-ID: Subject: Re: [RFC v3 5/8] dmabuf: Add gpu cgroup charge transfer function To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , 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, 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, "Subject: Re: [RFC v3 5/8] dmabuf: Add gpu cgroup charge transfer function Reply-To: In-Reply-To:" 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, Mar 22, 2022 at 2:52 AM Michal Koutn=C3=BD wrote= : > > On Mon, Mar 21, 2022 at 04:54:26PM -0700, "T.J. Mercier" > wrote: > > Since the charge is duplicated in two cgroups for a short period > > before it is uncharged from the source cgroup I guess the situation > > you're thinking about is a global (or common ancestor) limit? > > The common ancestor was on my mind (after the self-shortcut). > > > I can see how that would be a problem for transfers done this way and > > an alternative would be to swap the order of the charge operations: > > first uncharge, then try_charge. To be certain the uncharge is > > reversible if the try_charge fails, I think I'd need either a mutex > > used at all gpucg_*charge call sites or access to the gpucg_mutex, > > Yes, that'd provide safe conditions for such operations, although I'm > not sure these special types of memory can afford global lock on their > fast paths. I have a benchmark I think is suitable, so let me try this change to the transfer implementation and see how it compares. > > > which implies adding transfer support to gpu.c as part of the gpucg_* > > API itself and calling it here. Am I following correctly here? > > My idea was to provide a special API (apart from > gpucp_{try_charge,uncharge}) to facilitate transfers... > > > This series doesn't actually add limit support just accounting, but > > I'd like to get it right here. > > ...which could be implemented (or changed) depending on how the charging > is realized internally. > > > Michal