Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp449918lqt; Thu, 6 Jun 2024 08:15:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+ok/wwPVLU0q0rADzww2/FZX/J21fVdmwKlZ1Pm/mlH+OZ5EPwV4k5yhanjACYPSAQV9GzdvRAj+trgiZAZVXKBp1UZqrFrj+bBBkCg== X-Google-Smtp-Source: AGHT+IETBSTjy5WaFbrq/v4y9TKgZs0hvxKStRwCH6JEUFT7zfWGDoYdWUURfKVimeZyQHu6+YmL X-Received: by 2002:a05:6512:b99:b0:51f:51a6:eea8 with SMTP id 2adb3069b0e04-52bab4b889dmr4650860e87.7.1717686912739; Thu, 06 Jun 2024 08:15:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717686912; cv=pass; d=google.com; s=arc-20160816; b=PXImAuNph0g9qt+RMXyC0RMQ8jIbGx0zv6ejfURzivhGQYueanXLzJiuwxYb1uVkt+ Atv2kFwtgWwZuFm+Rme0j2mj/FgYWjzYvUwFWFEINsFLkC6n2rq/Ev9cW8cASPYq7EEC txI7BVWTlMKZzf0DLpMNtumikZ45gLzEXyTvymdQFgDKZwCMLVSKQ8hJbV2QLoLSu0ON 84ydLoqkuzkM2e7zcXq7vFKUZpSGEz3ryTEJOjltlgJxdGyjuhXlHy58TM+hKK8CEosl tzu+XvdSqGKLyu8HX29rjf66Qjn3ykS91bhRLsiXFUq8JYezgjQUSiqKufPMVsNZUobI TaWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:message-id:organization:from :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:references:subject:cc:to :dkim-signature; bh=/+jXPZYib6yHcvZW5Ip6f8nPyxAyr82A42Wj2kEms3E=; fh=2DRT3pD8+SQMQunKsG6ZX/sZ7BVuvJBa9lPG2phALLY=; b=DHh8RRgP1l/nABg6SGIR8QdtXdZDrvHTNAay3taSu92nKlH1lOpQ2UKflssnDawcQS lojh1aAqW4j/G2DBA9YIQZiw+QnPQ3GNL9ibYFpRcG3NBWoiFA3+ZpDbQWEhC7cG3p1Z hHqs4k0akhFPcv2ToqqVTCBOtnoJCjHeDKSef0v7r+/Sh4T9TQgVOu4dCKZnTak/K1Sk EJ5xWL/F/NGhbzLWWMD4XYU4z9n3TkkW0QoxAq7Q9gfqkIESthzzg3Q/nQgiaGXhgbUH /d1AWoDz23YPYi7o/QfJL6lPJJd3mhyz8XlW5a2yINN8RLc1PBcAJvSzJGHpfddbZ2OR uRxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rlw+lGM2; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204536-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c807080e9si77313266b.646.2024.06.06.08.15.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 08:15:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204536-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rlw+lGM2; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204536-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6ACEE1F256CD for ; Thu, 6 Jun 2024 15:15:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED7751A2C1F; Thu, 6 Jun 2024 14:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Rlw+lGM2" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 437131E494; Thu, 6 Jun 2024 14:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685532; cv=none; b=AY+SDucKsnk5fNKhdRgDnoxxiaxswAHx9QaleaHkWr10cHlcuhWspYfYVPD08Cw/5LM5DX3GSLEzb2xr01uiT1bhX/mWELTynW89S1ABYD5WmbVGGSfnHjoN699W3pgnglLLLD+MrvIzALferxelzLVa8VXN72QsNvNc37QyqwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685532; c=relaxed/simple; bh=ih5KlinNy99KtipdP5e9vfFOB8HH84JHruKk/DTM7Nc=; h=Content-Type:To:Cc:Subject:References:Date:MIME-Version:From: Message-ID:In-Reply-To; b=NVn37fxvEjRze5UOqPB1ezjdXLpZGVOrdXB3HetqzBCVvn15J2aEYbIqH2D+q7ly2uYe8E6DMB6dXlHXKvyKcQj4JzCXPKCwO6OgFRKtsWHRXaC/9EFJ4fu37hsDueFJU9l1KxWgaknRUhF5JYo648T+YHwksaPhw5Eu+O3It4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Rlw+lGM2; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717685530; x=1749221530; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=ih5KlinNy99KtipdP5e9vfFOB8HH84JHruKk/DTM7Nc=; b=Rlw+lGM20SCbtTpGX9R9Y09o6a71J7ol1i6rtc+fDQ6YglQshpRiV5ck /GjOWtLKD3r3FAzunDpl0UGzq+Q7xZhaNC7s4ZhPjTZXqrKRJeVhZJL6G h8Jgzp0qJJ4VTpb//yeLTCv6MgTT2SkhLvccJn8iy5KKTlZaxoRTbFmQu o/wZDJb1mRz77/GK1LtNlDVNf66F5vmSKPnhNBeGJ41l1Gxwlnt/78qiJ 0+oXRy+Ezi6SCzhnW5QFqmVlysXiVzMjbu8/Qm1vBv/Mlv30ESWCP8A0Y Ea0VXs3/CYt4y6Kd3/Z2iHJ34om1ADMl48Cg9Pvz+nkj3VZqkYBln/Rp7 g==; X-CSE-ConnectionGUID: 8sfd12fuTvOhlUO+eOjq+w== X-CSE-MsgGUID: MjhTErU/S/SEOsOBdrC4Qw== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="17292290" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="17292290" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 07:51:59 -0700 X-CSE-ConnectionGUID: 4AS7pECdTOShdbhz3z/Icw== X-CSE-MsgGUID: Yob9KelaRo6dwLNTOd73AQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="75459722" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.168]) by smtpauth.intel.com with ESMTP/TLS/AES256-SHA; 06 Jun 2024 07:51:57 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: jarkko@kernel.org, dave.hansen@linux.intel.com, kai.huang@intel.com, tj@kernel.org, mkoutny@suse.com, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, sohil.mehta@intel.com, tim.c.chen@linux.intel.com, chenridong Cc: zhiquan1.li@intel.com, kristen@linux.intel.com, seanjc@google.com, zhanb@microsoft.com, anakrish@microsoft.com, mikko.ylinen@linux.intel.com, yangjie@microsoft.com, chrisyan@microsoft.com Subject: Re: [PATCH v14 02/14] cgroup/misc: Add per resource callbacks for CSS events References: <20240531222630.4634-1-haitao.huang@linux.intel.com> <20240531222630.4634-3-haitao.huang@linux.intel.com> Date: Thu, 06 Jun 2024 09:51:55 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: User-Agent: Opera Mail/1.0 (Win32) On Thu, 06 Jun 2024 08:37:31 -0500, chenridong wrote: > > > If _misc_cg_res_alloc fails, maybe some types do not call ->alloc(), but > all types ->free() callback >will be called, is that ok? > Not sure I understand. Are you suggesting we ignore failures from ->alloc() callback in _misc_cg_res_alloc() as it is per-resource, and have ->free() callback and resource provider of the failing type to handle the failure internally? IIUC, this failure only happens when a specific subcgroup is created (memory running out for allocation) so failing that subcgroup as a whole seems fine to me. Note the root node is static and no pre-resource callbacks invoked by misc. And resource provider handles its own allocations for root. In SGX case we too declare a static object for corresponding root sgx_cgroup struct. Note also misc cgroup (except for setting capacity[res] = 0 at root) is all or nothing so no mechanism to tell user "this resource does not work but others are fine in this particular cgroup." Thanks Haitao