Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp54561lqo; Wed, 15 May 2024 07:35:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGxIuYA/iw+5MvVV4YlkYt1oUd9eEeo/BU19ey7U53aD4ThoeRrdAGhkhlIbMGFk9Hi8J+OXw9Cwl/t/D+jHZWR+KHU6wzQ8WgYXdDFQ== X-Google-Smtp-Source: AGHT+IEC6bfZ7IYsZeE8nfh0bUOhf1aUxSnbOulAsPfEIUiEluz+5qD7UN2FqNvHLqrZqk/KwuwK X-Received: by 2002:a05:6a20:7486:b0:1af:889e:8b06 with SMTP id adf61e73a8af0-1afde10ad77mr21611072637.35.1715783720500; Wed, 15 May 2024 07:35:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715783720; cv=pass; d=google.com; s=arc-20160816; b=fI54tAK8Wbg7mUl4lA8bdsR5DNOd+crTdUldLglM2WReg6sBQVG3lSeJuWkXnkKfTQ lJvcDSKOpb7iOJuqaiPM3aaVSBUYWf5a3H42jiuGSGg0IBWHG3c8kR6pbMtY9mcnTLG/ SThOddb3RYtmGkt8cLZX2kYyX0GFikW0XgTahrKzEqA+mr3llV0zA00pybT9SEDCyeqr T6YOdRO5/FpV5suk0L/WhYlk5WKKwTCTC1Oka2bbmzPJ91I7OW6s/IQAdEn9d0lwdV+8 wW9YGVS0SoduM+zB0q1JNsjHsIaIV4uIWNdfCK6pYvqGvgc6FPTJW3Vrh2ZG1YrheUva NnAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=dr9mNswvcvBd9WqlAZgQGwBLXCaYq7xTM96/AZTgX+A=; fh=yLYaby5qoarEilcPOJcfJaiP1KPbfwM9bRN/jIbOYTo=; b=xO/OAiIvb6sUWouUxLax3nX3841WALIqG37NKQvS/z7u4iO+1QcGbSvBphzyp3zbDX zoJcvvZTJCUZvFSpXfRP5EX7LkkEiyQz9uWD/ePYANczCbyzW7GbgJJilm56XYiuQ/Dg QFTPRfO229qfOgdSSiRwx6e80z9TmbJ/qn2In+qg5iZzG+pAnvKZk2rrZHqitVGQ2PU2 xUslZ1+2e+U5lDiz4LVRpQ4yjKc7buVQVBB/WoE0VZCq/uMeaTLBWIYX+ydiVBOlDJHf 7iunTuKzs35ClVZ3V7YfPwZfgRy1OEI4MtEf8CI0D6/CigIxFSuNwZWYEi40TXKcuFvv dPtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CFBIA5Ip; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-634119043a9si13340240a12.597.2024.05.15.07.35.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 07:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CFBIA5Ip; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0CB5FB224B2 for ; Wed, 15 May 2024 14:27:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 240DE13F458; Wed, 15 May 2024 14:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CFBIA5Ip" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 E805A13FD63 for ; Wed, 15 May 2024 14:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715783217; cv=none; b=gXdUXJT/T0DPs3uTZx87f4fuQmOFJ/Q9lE7S123fofu6+OMpNP37se5lpHNith0C95vxXDFMTSLHaiNEO+3hUW0JgV19rbPIlY4p6gWZglwIVbgqkpDIiP9aG55JYp9DbxI7PvD9yTwiIwJNjbATAyfkwjeVPdjEGjN6mciXG3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715783217; c=relaxed/simple; bh=3/kkrVAGWdyljIyHay2GaPkAwneBSvii/bd21+FNYVI=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=cMNIkpcVF6KxKzIGMsUq5Wih816CMcCWRw8r1ZvY2R/WGys4X9CNVa1BwSx19YLxf45UfDO3cFV2qgDUcFIR0pbhEqxeeB3q0QEj2ze1fPuO1nUaY9i9EjRrxg2ohFk2VNQcPih13vLvO0Qdgh4uzdXy5lcQdB+mc3qS6SFGsx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=CFBIA5Ip; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715783214; 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=dr9mNswvcvBd9WqlAZgQGwBLXCaYq7xTM96/AZTgX+A=; b=CFBIA5IpuMKFC3hoT8whw9jfEFZRy2NddSELjLPzsidnB0ArIizHlOIsaQUtbqEMnZ77Vl QVTm/Ci/F+CTfxagcqrgZYmv4/AenvvWNWvBUbXTRXL5Qqf+5BXtHUzVVDR7T2u7JE+a9K uxKDGqQzynLjneGwWSlFo4+GAet3ahE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-158-IMkfSYF_MDGVrIvfYLsGcw-1; Wed, 15 May 2024 10:26:34 -0400 X-MC-Unique: IMkfSYF_MDGVrIvfYLsGcw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5501585A58C; Wed, 15 May 2024 14:26:32 +0000 (UTC) Received: from [10.22.33.50] (unknown [10.22.33.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15ACC28AA; Wed, 15 May 2024 14:26:32 +0000 (UTC) Message-ID: <11b8c1e4-45a7-4895-a1f3-6626744cee1e@redhat.com> Date: Wed, 15 May 2024 10:26:31 -0400 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: cgroup io.stat propagation regression From: Waiman Long To: Dan Schatzberg , Tejun Heo Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org References: <3ed32279-904a-411d-91a4-a62f4ca2dde2@redhat.com> Content-Language: en-US In-Reply-To: <3ed32279-904a-411d-91a4-a62f4ca2dde2@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 On 5/14/24 23:59, Waiman Long wrote: > On 5/14/24 15:25, Dan Schatzberg wrote: >> Hi Waiman, >> >> I've noticed that on recent kernels io.stat metrics don't propagate >> all the way up the hierarchy. Specifically, io.stat metrics of some >> leaf cgroup will be propagated to the parent, but not its grandparent. >> >> For a simple repro, run the following: >> >> systemd-run --slice test-test dd if=/dev/urandom of=/tmp/test bs=4096 >> count=1 >> >> Then: >> >> cat /sys/fs/cgroup/test.slice/test-test.slice/io.stat >> >> Shows the parent cgroup stats and I see wbytes=4096 but the >> grandparent cgroup: >> >> cat /sys/fs/cgroup/test.slice/io.stat >> >> shows no writes. >> >> I believe this was caused by the change in "blk-cgroup: Optimize >> blkcg_rstat_flush()". When blkcg_rstat_flush is called on the parent >> cgroup, it exits early because the lockless list is empty since the >> parent cgroup never issued writes itself (e.g. in >> blk_cgroup_bio_start). However, in doing so it never propagated stats >> to its parent. >> >> Can you confirm if my understanding of the logic here is correct and >> advise on a fix? > > Yes, I believe your analysis is correct. Thanks for spotting this > iostat propagation problem. > > I am working on a fix to address this problem and will post a patch > once I have finished my testing. Actually, I can only reproduce the issue with a 3-level (child-parent-grandparent) cgroup hierarchy below the root cgroup. The dd command is run test.slice/test-test.slice. So both test.slice/io.stat and test.slice/test-test.slice/io.stat are properly updated. Cheers, Longman