Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp890785iob; Wed, 4 May 2022 10:02:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWkxVI3R5DwxgzUwaHGPt9sU2FpKd/8vOvLlChHezc0aGorUObCU++xP+aT7Vst1jSXqx4 X-Received: by 2002:a17:90a:8044:b0:1d9:7a6c:38dd with SMTP id e4-20020a17090a804400b001d97a6c38ddmr489977pjw.156.1651683765676; Wed, 04 May 2022 10:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651683765; cv=none; d=google.com; s=arc-20160816; b=ayG9dHLeLCy1VbzurEcLxF5vz/hWSzIDpgC4aLzCYj96g7QuZplPq7Ya5EexrDKAMF ykcBecIJYvTNRHAUj/oC5swoV/Y4nUHazlMXmCpPJdhwYB6UD1yn2brwmo7f3i20Gnqt R8YkTIDFhsft+gTacKxcpV37iAU0hLGA4lI2o7BsXlHdeBSd5KE/qJ6S6ffNjIhsdKUT +WlNsikeTMvbpGbMm5MB9Zof/ExVzq9NkFrnqURqnmG1peXjsvrismOAGxqxJCdeDAbQ 0gXA0v9BNUdgsi5j/raQDfR+SALqaySqcaGQlFjbKK0IR5eLRwRUMdlzX+S0vnTrcNBa vhhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=doyRZ/aPo6CAu2aRJZdJIbiD5u5Ey0uZjhyvfP1Ctxg=; b=pdUmYhT1U73Mpg9ncUM5sU2xseDya2UOHWZvb5Lx48/la+yG40++XqNAJG+bA66+XX 9EIljUl1zdEAAfdXyfpBbu0ql+BITqeUn+jt6JppUkpERUXa/rZkPlpSDPaKGxnodvRN XWfqGBhTxIAF5vIyen2DTDPJujTVRev7jr9uXN4va6epwW/S2OfLiEAI6a9IcEf2+u3G z8XRjZMLOmu4QJal7YatahMAo65eF2JGJXeRkCFFyP9LDBHfNGWhhiOUKUYDODUoxH7m NSFYw6C3H1EcqzRgRX1yUCaQxgYFE1x2r/cfR3bViB7bHCdnfXm1lKacHCORHONvqEbE RXNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=N2vaxZGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a17090aa09200b001d8f9dac4c4si4127884pjp.150.2022.05.04.10.02.25; Wed, 04 May 2022 10:02:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=N2vaxZGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349456AbiEDM3i (ORCPT + 99 others); Wed, 4 May 2022 08:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345750AbiEDM3h (ORCPT ); Wed, 4 May 2022 08:29:37 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2FFF13E38; Wed, 4 May 2022 05:26:01 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 90E2E1F38D; Wed, 4 May 2022 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1651667160; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=doyRZ/aPo6CAu2aRJZdJIbiD5u5Ey0uZjhyvfP1Ctxg=; b=N2vaxZGJ2unb+3IDJGpPKSzFqAbVU0whcBJYvGepz19nZuYUtUZV1YeQwH/896HEErAkZE Y6ajefODov6DJ/roi62apFVoZZ+Qv0Mkw7J15GK+8M7slaceWBctJQU5sdF7elqYx4+hbf sd773fem46TOty3AXl7mg/7SEvNr6/U= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3F161131BD; Wed, 4 May 2022 12:26:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1Ld7DthwcmIuWwAAMHmgww (envelope-from ); Wed, 04 May 2022 12:26:00 +0000 Date: Wed, 4 May 2022 14:25:58 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: "T.J. Mercier" Cc: Tejun Heo , Zefan Li , Johannes Weiner , daniel@ffwll.ch, hridya@google.com, christian.koenig@amd.com, jstultz@google.com, tkjos@android.com, cmllamas@google.com, surenb@google.com, kaleshsingh@google.com, Kenny.Ho@amd.com, skhan@linuxfoundation.org, kernel-team@android.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v6 2/6] cgroup: gpu: Add a cgroup controller for allocator attribution of GPU memory Message-ID: <20220504122558.GB24172@blackbody.suse.cz> References: <20220502231944.3891435-1-tjmercier@google.com> <20220502231944.3891435-3-tjmercier@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220502231944.3891435-3-tjmercier@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hello. On Mon, May 02, 2022 at 11:19:36PM +0000, "T.J. Mercier" wrote: > This patch adds APIs to: > -allow a device to register for memory accounting using the GPU cgroup > controller. > -charge and uncharge allocated memory to a cgroup. Is this API for separately built consumers? The respective functions should be exported (EXPORT_SYMBOL_GPL) if I haven't missed anything. > +#ifdef CONFIG_CGROUP_GPU > + /* The GPU cgroup controller data structure */ > +struct gpucg { > + struct cgroup_subsys_state css; > + > + /* list of all resource pools that belong to this cgroup */ > + struct list_head rpools; > +}; > + > +/* A named entity representing bucket of tracked memory. */ > +struct gpucg_bucket { > + /* list of various resource pools in various cgroups that the bucket is part of */ > + struct list_head rpools; > + > + /* list of all buckets registered for GPU cgroup accounting */ > + struct list_head bucket_node; > + > + /* string to be used as identifier for accounting and limit setting */ > + const char *name; > +}; Do these struct have to be defined "publicly"? I.e. the driver code could just work with gpucg and gpucg_bucket pointers. > +int gpucg_register_bucket(struct gpucg_bucket *bucket, const char *name) ...and the registration function would return a pointer to newly (internally) allocated gpucg_bucket. Regards, Michal