From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 E16792EB866 for ; Fri, 21 Nov 2025 05:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763701676; cv=none; b=eHUsep9VsINJRb+RQHOfqAAF1kMHlhqkoiR9YQPyZEGJQAaRglXHXt6JiSqnWSGlnNvEybb25WKSdr6qAmk3syGRYx76Jpaohxy1f+UtnAhIN1MNpio/XGRVCpPaO9ngZrFPMwWTLfO7qInEcSzi9X65pzEvSARxcXFAWV0gWcw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763701676; c=relaxed/simple; bh=M4bU509Hi6y2iIef1Lo4i4r8kXSDq0QpDONxBWI0zYw=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=CwpIXuvl8fU82cv972dhk45yF3pZRBF+dISv3u/2oHjj47fQNUKud6HRpQleoEI+5etZ161qHbMuClfKmvNGklAn1gb6LHAsCzLX2rzkeuIz8Nf15KzW3pWrmYpXdzDZjaQ6vZ+K5PB9cRCB16BoPAsMehnD/zc961QFFCpcmHU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XlqwuDR6; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=G2/w7jO6; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XlqwuDR6"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="G2/w7jO6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763701673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xcqfPS7j13ZWD60dTrmDCM5p8py9aMO8JCZOetUJcKQ=; b=XlqwuDR63o9uWcQBkuV7i6yeOIICyyGu52F3WCBuWVdUfK2kS6iaRPAUczAr5YRN9H+tBb eh6uS5fJuiCrVKbJRiMTYkpvm0aXz/mRgLfW8FcObIUbj897rm8btKkmRTRwQtrmCcMlGw OD56eXJgIzk4kPUV6furm96RBfO2YWI= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-489-E1t-n4KuOhKMLeOK0PoOpQ-1; Fri, 21 Nov 2025 00:07:50 -0500 X-MC-Unique: E1t-n4KuOhKMLeOK0PoOpQ-1 X-Mimecast-MFC-AGG-ID: E1t-n4KuOhKMLeOK0PoOpQ_1763701670 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8b19a112b75so447978285a.1 for ; Thu, 20 Nov 2025 21:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763701670; x=1764306470; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=xcqfPS7j13ZWD60dTrmDCM5p8py9aMO8JCZOetUJcKQ=; b=G2/w7jO6SxFsI878f7R3sLbULszbMTiKY8URWV0yQUrA63YLBNwiIsV8dnvFfUE82r OMqsJlb61ET/gZWCmbODzF4G1wjzyB6tPGIrPVsEUzLdP8PjOkHdNrXhN7zgcP5+eb+g 9t0bSz5obIT1aDPECtbBSyN4QlFtU+DrV4/F8DaU3UZ/ykh/lrsxGen7TplJRAq4qrGf JaV3Oo5Y+SANmDscgZ6EczmhLSWdtnT1RNuC8yDZVBqTH6NAGqttte+G7SQ7Y6imLRYz pCHFPhbfdbpfzTaF3l7eNuH5IFgjP+GVBlHA+1DfwJc49OQqsDGpH/ztY1Etom3v82Vo 94PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763701670; x=1764306470; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xcqfPS7j13ZWD60dTrmDCM5p8py9aMO8JCZOetUJcKQ=; b=nZxBHDlEH/V+pvwSXUczwTBo9IrNuwZ+gabw7TfE0u0qWr/FJLPPMgt92p1Hbc3Qch 4viWAp+FX+kGPVcjUpYlecKGuI3pjT1THdbRjwg3sXeytf0sNmqPQmjt4hSjRD9MpguC GyNQKuAOX0/PCD5DJrvGA7CByOrie1sOuGR0INc+o9rsNWjkwtx8AQaI/E5IEl8FGWPr 7tlIAGBmPfiVKH349jbkxUrLkoCD5wz3LCKxCr/xaFV+FzBgYim3uOA2UaUjD2fY1Upi uvNg64xIOxoofsUnLwUyJnBtTEeXqrw0lPvXHFiWm1G7ywW6La8q6VUEJ00nljitt5p/ T8IA== X-Forwarded-Encrypted: i=1; AJvYcCVtKgq6kB3Mg3KRHvEjXiXnL2omcSFlMxhHluiHpVGB5es1nMxieK9fa/u1HCQfNvbV3Et9asKbKn40zjY=@vger.kernel.org X-Gm-Message-State: AOJu0YxMMSLl13524vh2c5IlVxssRjji0ihjBbpsM48RxSJlExrgbL+9 rLtxs+9bwjERlTk5tI6JV6m+MrQdmYkWRy3/LPCOuPt23Ggeljo8HGV6jPj4MdfClvT/LhM+pbD jRiWuKmwNql6vqLWKJiW/5Z9YqyNCfGL//X/fjF4t8SxptfbE/nWIBh/NDhAF8JlXSg== X-Gm-Gg: ASbGnctZMORDcw9nyeLM789oB6SEQTRyP744xMOSvVQ5UkyIiYdFppPTgddcwc3MPl2 bdQs0SmSfPraW+hp7jYsYmXYYnlpsciAylZWNXYbbQUipInGIHn/wdjIKYbFYUy3E3QG34PqE+0 LywmFMAlwD+Z75wD4mPkxNzdzfzXpIS89+hOEQglhxcDAeC8vuvrnqGaxuZEnAKPIaDLGuEjRA8 bFQcSQPnxxETGrKHi6HUTUYmn0NxeSLEP6hZyymbUM/tpXElNVUPM/6vePN3GDjjgtWQ80PHw5h h9V5eN6Cdi4WTlg3n6ZRD8mLF4HqwTl76MJWVA4ChJZzeo94kJnCVzJEXM7uOAxitKdRlSF4tH5 ML5NgvUewE0+n9tSd1Qbv7iwZPvX4zKtZUvCPHPkTg5nAA9CqESWKbKpj X-Received: by 2002:a05:620a:4405:b0:8b2:dd0a:8814 with SMTP id af79cd13be357-8b33d4afe3amr76000385a.85.1763701669779; Thu, 20 Nov 2025 21:07:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkAfEpATpg8tPvpQs+GS3hfE/hz9o5RS1C26qAzB+yAMLs90YO077Oj9VUdwtsb57bM+n7Zw== X-Received: by 2002:a05:620a:4405:b0:8b2:dd0a:8814 with SMTP id af79cd13be357-8b33d4afe3amr75998785a.85.1763701669281; Thu, 20 Nov 2025 21:07:49 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b3295deaf8sm297373485a.44.2025.11.20.21.07.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Nov 2025 21:07:48 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <6cd2dc59-e647-411f-ba3e-2a741487abb8@redhat.com> Date: Fri, 21 Nov 2025 00:07:47 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] cgroup: Add preemption protection to css_rstat_updated() To: Jiayuan Chen , cgroups@vger.kernel.org Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, linux-kernel@vger.kernel.org References: <20251121040655.89584-1-jiayuan.chen@linux.dev> Content-Language: en-US In-Reply-To: <20251121040655.89584-1-jiayuan.chen@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/20/25 11:06 PM, Jiayuan Chen wrote: > BPF programs do not disable preemption, they only disable migration. > Therefore, when running the cgroup_hierarchical_stats selftest, a > warning [1] is generated. > > The css_rstat_updated() function is lockless and reentrant. However, > as Tejun pointed out [2], preemption-related considerations need to > be considered. Since css_rstat_updated() can be called from BPF where > preemption is not disabled by its framework and it has already been > exposed as a kfunc to BPF programs, introducing a new kfunc like bpf_xx > will break existing uses. Thus, we directly make css_rstat_updated() > preempt-safe here. My understand of Tejun's comment is to add bpf_preempt_disable() and bpf_preempt_enable() calls around the css_rstat_updated() call in the bpf program defined in tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c instead of adding that in the css_rstat_updated() function itself. But I may be wrong. Cheers, Longman