From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-236.mta0.migadu.com [91.218.175.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA42A2E282B for ; Thu, 20 Aug 2026 09:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.236 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787219889; cv=none; b=qHUY936pVxAPDxqHOHo1HNd8ZBZCeTYBrIBCDGB6ZgfkHaW84eLu0wln8UPkikjmfw89/9sbFsZjrLuNUuLUIeSuunl1kOr1jxh15EPLYQI4xBNJVrK87dX4S1HwMqh4GVe+aqG0FmKIxM7QHYS9sghIe62StPqIoHTNdQl0IhY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787219889; c=relaxed/simple; bh=ploZAqY/D2hnRbV7P/iJz6tixE4616igwYG3fSAUDUQ=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=TA6bKmhK8yORzrmOp06YPSEm+BkyektKEV+n4LtJr1VOeypgM/ElLxE3B5hyv7LGU35JACe5TzuBm0fvGptbzoBo48+qMk4GosbDSmXAwIXnEYsCtAAFjHLarBqRpkDFVO4OGw+TgyfSl7xi1s3jFTOdL4wIcXzmje4sf8S7ow0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=rTvXJSV6; arc=none smtp.client-ip=91.218.175.236 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rTvXJSV6" X-Envelope-To: gfs2@lists.linux.dev DKIM-Signature: a=rsa-sha256; bh=ploZAqY/D2hnRbV7P/iJz6tixE4616igwYG3fSAUDUQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787219885; v=1; x=1787824685; b=rTvXJSV6IfHJ3vVMJSs6W0cI37hb9ChQezDcFOAHWHjrHGHskywPMXKZV9kAcLahLhKR6N4Q cV/sC+jlWGVp6uuokebf8slbI/NHgebxah+Xu+cI4z9kp1OCXt5fgduNI0rDbP5AnoPZHf3U5fG vrirR4u/g5kP5+yf2V11FLpQ= X-Envelope-To: gfs2@lists.linux.dev Received: from [192.168.110.173] (223.70.159.239) by smtp.migadu.com with ESMTPS id e22b78b065807185; Thu, 20 Aug 2026 09:58:04 +0000 X-Mizu-Trace-ID: e22b78b065807185 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Thu, 20 Aug 2026 17:57:50 +0800 Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: cui.tao@linux.dev, Yu Kuai , Christoph Hellwig , Jan Kara , Ming Lei , Jonathan Corbet , Shuah Khan , Coly Li , Kent Overstreet , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Song Liu , Li Nan , Xiao Ni , Pankaj Gupta , Dan Williams , Vishal Verma , Dave Jiang , Alison Schofield , Ira Weiny , Andreas Gruenbacher , Matthew Wilcox , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v3 1/3] blk-cgroup: use a request_queue rhashtable for blkg lookup To: Yu Kuai , Jens Axboe , Tejun Heo , Josef Bacik , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= References: <20260818070641.756747-1-yukuai@kernel.org> <20260818070641.756747-2-yukuai@kernel.org> From: Tao Cui In-Reply-To: <20260818070641.756747-2-yukuai@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 2026/8/18 15:06, Yu Kuai 写道: > blkg lookup currently uses a per-blkcg radix tree keyed by request queue > ID, plus a lookup hint for the common case. This spreads the queue-local > blkcg association index across every blkcg and requires radix-tree > preloading before creating a blkg while holding q->queue_lock. > > Replace the radix tree and lookup hint with a request_queue-owned > rhashtable keyed by the blkcg CSS ID. Cache the ID in each blkg; the blkg > holds a CSS reference until after it leaves the hash, so the ID cannot be > reused while it is hash-visible. The integer key also reduces hashing and > comparison work relative to a pointer-sized key on 64-bit systems. > > Keep entries until blkg_release() and provide blkg_lookup_any() for callers > which need to find dying entries. blkg_lookup() filters offline entries so > existing lookup semantics remain unchanged. > > Keep q->blkg_list for ordered policy and scheduler walks. All current > walkers are cgroupfs or sysfs slow paths, so they can move to rhashtable > iteration once the q->queue_lock to q->blkcg_mutex conversion lands. > Initialize and destroy the hash with request_queue, and remove the > radix-tree preload paths which are no longer needed. > > blkg_release() removes the hash entry only when the blkg was successfully > inserted into q->blkg_list; the list_empty case covers allocation or > creation failure before insertion. Reviewed-by: Tao Cui