From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796320775; b=try6OiY6fu/QsE5QWxB3ttU/NYImPclbGmIdHLVzyN6HyayIJGsGCwt9+KY8hlZDo5iu QbVrAUKI4h/1mpWUnipscsAEz/T2wlIvqwAFA/Znd+B0+nVILGr+PXlwXBdP+BZrD8mXg lRnLcMJzvDiloTiOzpS3T8Lc8TQnk7LbwbRvEuuxP/32dbqOW1sr+o/937g01fC/Hu4h1 2OsngbrEEXwDQ6XsqfKsj9BeGObQKFHuGMLVZ1Xfyev1yxARzNDHKLrE+OKTzaD4qboT7 8Aq714vl4sfuqGFMxw8/fENt9zIpVrttFcN4CYNkPxnd/Z30bzx0JyRdjDOdv3G/bEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796320775; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=kdams8HEdv5LrtyWevBquqaZ2RVzxCL+cZwfTGPC6k4=; b=v32tXRN6ULqeteCLVI3HydEd7RVtloQH2ceqFuAqe+pnNHIk4A71ub20owwibjIMGfSD PXb1vJc176f4a8FyeSJTjBvm6dx6r0TL9JPy42DOY/FLQRwe/JpzSnx4xYgGslWgYgGI9 b4kHdQ9P+ETlnOshWa1wvOmqYSFhxtOOwrNPaZ/2pppchKcBy80okIHrw9D1LB702Cvze CfJr2tf7TVGdnC4UTJqLz/bWIdKBNakeoVjX799fasS6jqbRPbPTftnglJZkFGb98Nw7b Soioo6SR5kDxhJH+8ITq4ER1IijqXx9YvhShEf/rmJ3XgbS6PfdwY4kfwWbU/PMwvDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass header.d=kernel.dk header.i=@kernel.dk header.a=rsa-sha256 header.s=google header.b=YZtMmtu6; arc=none smtp.remote-ip=74.125.82.49 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7627606A689 for ; Thu, 3 Dec 2026 17:59:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E7627606A689 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.dk header.i=@kernel.dk header.a=rsa-sha256 header.s=google header.b=YZtMmtu6 Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1b5adf7eacdso47949c88.1 for ; Thu, 03 Dec 2026 09:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.dk; s=google; t=1796320773; x=1796925573; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kdams8HEdv5LrtyWevBquqaZ2RVzxCL+cZwfTGPC6k4=; b=YZtMmtu6pYhrDG9GJaEPJaAM19u7mTQQ2mT8S/je5/rW7vJwKJd1ymTzY8h+JW09iK EYiSQS/TTZtPL4X0l4rCaOkJHILtED7T3rxfOlF3mUKPLP6cuSRnWSDcDrWlcBWd3dBa I1MK21EnaBFF7ivfZakzCw6zHOO9CmBAHkeMNbx2E8B/FcFzmoaqXo6gIvkwXIn4Z6wt IR9s00Y5/se/Kq1j6CL6qkxO4GD9W/1IC9K8t3uu2n1KIfRPborgNIKFgqE6Bgp8siQl knLj/TWDnoMZMB8qL46jpQAGhyL52flWGGF12uq/Iyu8UmKR1pgDZ5bhIjD0g0fe8uRX FusQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796320773; x=1796925573; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kdams8HEdv5LrtyWevBquqaZ2RVzxCL+cZwfTGPC6k4=; b=DAG0UIqLR1ULN9klk/65CqjWO+Rp6avt6k8PeiU3Y51ILyPXBW8ZhdAMlW2oMAcP3c PrJ0B0kNdRvAplqwbL110zjmDhPtoBCQGA5T6yq+0DXSQsJ68qzOz0SJosUiahdj5ghU s1tItnLfQLbv11+4W/u/ULAKggxR0oFHq2BZfJFM0m/g/9eMskDMbNFBnW/zOkU/Ne/U DNTTCkr6XTCCKp3w7DL7mmuCFDasOrkPmPNuj9p1ThPYxEep4c4hFUSq1XC7d59AK15S hwjvpuWQXhGy83RtEZhTPpmvgnYANyoFb+MHaWUMDkcqBG1XaoGWx1QqHB35ayhwRCoM m9HA== X-Forwarded-Encrypted: i=1; AL+hErGLMR4OnTv/I8rhFQCmBqUJyG7E3dCxXsXDMypQ6T2CFvlkTcDr6t86YkJu2Ji3MVvR64Z5RTfTC9Hcdw==@vger.kernel.org X-Gm-Message-State: APuU4Z8bJd3M6sWM3r3Doqi4dZ9+3J2obY7LKFUVg90CxVQF5T8ZK8i4 O0l9e8S491n0jjMGRhtT3W4Ur5W/+Mg/9lMGgjUoFGfWGwsEFCBolXFFWyhlAY9RVp8= X-Gm-Gg: AZFdTZflqqTNy97gocEu/RtaL82KLDBfnLJMQKYR9Uq+wUMJJ8fKAgChtLmGk0BfIzo NP2x3bfZ+ivPUEk9yi0vJ4Wcm1Th0Ftu2zy2wAIwIs8uNu1c2bCt1QHVGX2xdSgV80wjPjRtrmE vfEKJ9F7MsHvJRUdWkvPmN7dXBZ/8hzN0mgbqp5oMV6VXc+44puG5ge6/Rs+MiFsjlwY07HSAyt 19nNJC9Bz8EbuVUIzdEjTQl/3aNjC/KO+Xpp5dj/+iPga3dmmBsTQIYoKd4s1GkMQ+MTofSUB2s 7NUjaT9kBfV5RpvO3Oy99QvI4JrDhm5ejAGzH4/7WxmXV2Hk+Yfgvpk9VBebgPAI1zqtKsWrPgM YcDcP2LgmrS2NHomsAOpSoAiIaZW/ZjQvFwLiTS8PldNbu9aJEdwz12mZh7aTJPGUn2qHjWFEcL 1b0QT6908xC9paizZJHKUMy21TwZPOzl6SrpDzj8sNyrIN4HS7YA+0eGcW1v1ny/4Mx169i0Zw7 MUpJiyZe7A7bAAtj0x13o5a+M7ivluqJFwg38mYuVsluQjPQTFa+KLlFaBgSsPOM26E2tY3BWDl h/KwFMNJQRbDM3NLOjnNd+Q5z2AkqTI2o5/aTagszwDqYMc2zRosZV+YPdyOaBwCnftUDHrdAaJ zMmSdhMae55mZbJdWYSiw3hCPRZ6EsuDOcSpaWELs/UkFQxI= X-Received: by 2002:a05:7022:f513:b0:1b5:3878:aa29 with SMTP id a92af1059eb24-1b55690f9d4mr43721000c88.38.1796320772852; Thu, 03 Dec 2026 09:59:32 -0800 (PST) Received: from [192.168.1.142] ([198.8.77.135]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3874af8e2b5sm3851046eec.7.2026.12.03.09.59.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 09:59:32 -0800 (PST) Message-ID: Date: Thu, 3 Dec 2026 10:59:31 -0700 X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Per-bio cost of BLK_CGROUP=y, measured after 7693e1350b06 ("memcg: make MEMCG select BLK_CGROUP") To: Fengnan Chang , Christian Brauner , Tejun Heo Cc: Shakeel Butt , Christoph Hellwig , Josef Bacik , Johannes Weiner , Michal Hocko , Roman Gushchin , =?UTF-8?Q?Michal_Koutn=C3=BD?= , cgroups@vger.kernel.org, linux-block@vger.kernel.org References: <20261203130234.3718286-1-changfengnan@bytedance.com> Content-Language: en-US From: Jens Axboe In-Reply-To: <20261203130234.3718286-1-changfengnan@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/3/26 6:02 AM, Fengnan Chang wrote: > Hi, > > Since v7.4-rc3, commit 7693e1350b06 ("memcg: make MEMCG select > BLK_CGROUP") forces CONFIG_BLK_CGROUP (and with it > CONFIG_CGROUP_WRITEBACK) on for every CONFIG_MEMCG=y build. > > After it landed, our block/io_uring performance test kernels got 4-14% > slower on single-core io_uring 4K random reads: 3.8-7.4% of IOPS with > the task in the root cgroup and 7.1-13.8% in a non-root cgroup, on > cgroup v1 and v2 alike. Where the core is the bottleneck that is > +65..+172 cycles and +208..+590 instructions per I/O. Ugh... Unsurprisingly, because people seemingly never performance test features they add, they just assume it's free. Or if they know it has a cost, then the excuse is usually "but it's behind a config option so people can just turn it off", when the world runs distro kernels anyway and distros turn on everything under the sun. So yes I think a series (greatly) reducing the overhead of BLK_CGROUP would be _highly_ interesting. I'll echo what Tejun said, do it step-by-step, and have profiles and numbers for each step. Thanks! -- Jens Axboe