From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 A4D6D2D0C8F for ; Tue, 14 Jul 2026 09:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784021753; cv=none; b=bBwPOMXYGX/iRNHv5KWN8DcbKnTak3dYdz+RTBT0olS5B0un91H6Lq4tbRgWSWb9lZquMs5tIiqc520DjU892+QL+y8RApkNWPuwJOg/9/onoa/MCNN0MfE/XTCPx0DcAxNPIAnmA6o8BkhnwnxXXBId7e86FAe8oYl8Al9pW/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784021753; c=relaxed/simple; bh=BRADXR9fMPNQp8BNACi30IQM3c6MRL1iihXzYYgpM7c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L1oHOCqlLuKcpkA05kSVXPsDwVpo4xona3k420oDRurvqj/6YlHDbH8bKOuuy1RHvFxBuVVUeWTWO0y0B6s+Pc58R+NPl0p6uf/ZlCmNPTOIjG6VHW1JoPchM7we5rcpWMlt5uJjmNegIzw6ejcj3m5vr24sSWmE55Ku5xvYRpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KJVkrEWm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KJVkrEWm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4FBD1F000E9; Tue, 14 Jul 2026 09:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784021752; bh=UfnergjAnRDuo3uYbSqLR2MsPNG6su0Cxt59mBpdmTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KJVkrEWmExl50s4hRp2xoNRfweUHQXFOAgBlRs6oo775P3o0VLXSLkfrzgNrtQQmo oI3BEQeV9kivBQi9nW4Y2K6tQRvUwagl1yGAubQxpjvS1VWBuywzW3/mGBbITh2/+R z37Om5e7uLXAWsZ61BxwGzFrBz08y5OQfMLqPoSF379dizDuxzPkeFUqag6EW33doD ulkgdbeimMWqLsvdOZh3dVq1ZM/Z/oVkn2dLMihkG7XOl5MIWO/w2rIQhsp+Op2/Ah /pfF/8OBz66RSD8tq76RiRnixipBpoZj27RWNE3CUM+Su2MPLSqS49rouf5tN5tbZt UNkvSg87FW63g== Date: Tue, 14 Jul 2026 10:35:39 +0100 From: "Lorenzo Stoakes (ARM)" To: xu.xin16@zte.com.cn Cc: akpm@linux-foundation.org, david@kernel.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, chengming.zhou@linux.dev, qi.zheng@linux.dev, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, wang.yaxin@zte.com.cn Subject: Re: [PATCH v3 2/2] mm/mm_slot.h: add comments for mm_slot_lookup/insert Message-ID: References: <202607140924549782dUh3YBPmy8g1NDMK2zIW@zte.com.cn> <20260714092815120Wv-CFDlLKtsTmda--97Qw@zte.com.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260714092815120Wv-CFDlLKtsTmda--97Qw@zte.com.cn> On Tue, Jul 14, 2026 at 09:28:15AM +0800, xu.xin16@zte.com.cn wrote: > From: xu xin > > mm_slot_lookup() and mm_slot_insert() are the only helpers in > this header that are implemented as macros rather than static inline > functions. This may look inconsistent without explanation. > > Explain they must be macros because hash_for_each_possible() > needs the table as an array (for sizeof), not a pointer. > > Signed-off-by: xu xin LGTM, so: Reviewed-by: Lorenzo Stoakes (ARM) > --- > mm/mm_slot.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/mm/mm_slot.h b/mm/mm_slot.h > index 5de3e91d86b4..9b09b68e5742 100644 > --- a/mm/mm_slot.h > +++ b/mm/mm_slot.h > @@ -33,6 +33,12 @@ static inline void mm_slot_free(struct kmem_cache *cache, void *objp) > kmem_cache_free(cache, objp); > } > > +/* > + * Note: mm_slot_lookup and mm_slot_insert cannot be converted to static inline > + * functions because the hash helpers (hash_for_each_possible and hash_add) rely > + * on the actual array argument 'hashtable' for sizeof() instead of pointers. > + */ > + > #define mm_slot_lookup(_hashtable, _mm) \ > ({ \ > struct mm_slot *tmp_slot, *mm_slot = NULL; \ > -- > 2.25.1