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 0C094220F2D for ; Sun, 9 Aug 2026 14:03:44 +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=1786284227; cv=none; b=JtJBXkRWPBfpxjgmbg9mBhjXv7aBH1Df5QVYr7NwdU6HOdVPgHZVlt3MrVtwOkigr1ZK5Azd/3cmu79hyz9CRkDGmVJGz76H02HhNQFxtr9rm3kOddQJPgXRk0QpTSJ7K3i1Pf+diuuAXqTtQFMTwYN9PtpnAd16n86wqNanft8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786284227; c=relaxed/simple; bh=fhnVLOIFHj6NzWJqp87Mg/9iifDblxgm24C8LqLiyKc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jDR+BC7n3rT36iCjNm4mpGmQhAdX25p0EeedkKds4GZ/FMd4xJC1u7rzIQwfgweEQS+fdgcLgHBB3nl+U6XzB1Q+fggy+wdVYQE/o08dN/H5MvPWkmC4CEUCiBMbnJIngMg5kjz7Fl7iPz0KgBFTZ1X2F0st3iWXasIY6gm7hKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eem74xGm; 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="eem74xGm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6DEE1F000E9; Sun, 9 Aug 2026 14:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786284223; bh=8R5Hp4lAYk21jzt2d53dHdom5AbkPCz9hSGN4NvOnCk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=eem74xGmmfxX4i5JGj5geIWcHbuRewGhh7jtDenQX1rUPWDua13ZDJoWcbiBDD6xv RqDLgzNIa3BbyJlCevTg8MNcziZWAbPAG7qqrRUvwgaXnhXrFcn+AzZxoq6a92f/5g uu0HuXuNHMYFgYdinigoKyGTDpiIZd7gCDmOr330AFuevEFo84RBz6zmUtC6J4UzZj 2dgDt0mxAPahvRLYoJwwmFtFHQLbemX2BLnJEZcKRx5k049uI1QCAPV0r48fFZbzMq RRcM/Pwx41eRaDNfkvMjOm7ky+QtZng3gVmecZLGxWtgSQs3u1PFrgpBWbL5dW1cHL Qfo3l3WHevXLQ== Date: Sun, 9 Aug 2026 17:03:37 +0300 From: Mike Rapoport To: Longlong Xia Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Longlong Xia Subject: Re: [PATCH 1/1] mm/mm_init: compute hash mask with unsigned arithmetic Message-ID: References: <20260809123119.3811851-1-xialonglong2025@163.com> 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: <20260809123119.3811851-1-xialonglong2025@163.com> Hi, On Sun, Aug 09, 2026 at 08:31:19PM +0800, Longlong Xia wrote: > From: Longlong Xia > > alloc_large_system_hash() allows up to 2^31 buckets, so log2qty can > reach 31. At that limit, the current expression relies on signed > integer wrapping to produce the unsigned hash mask. > > Use an unsigned literal so the mask is computed with unsigned > arithmetic. Supported compiler settings already produce the same > result, so this is a source-level cleanup with no functional change. If complier already takes care of this then why do we want this patch? > Assisted-by: Codex:gpt-5.6-sol > Signed-off-by: Longlong Xia > --- > mm/mm_init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/mm_init.c b/mm/mm_init.c > index 498d62c4ece3..1883fe923ffb 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -2469,7 +2469,7 @@ void *__init alloc_large_system_hash(const char *tablename, > if (_hash_shift) > *_hash_shift = log2qty; > if (_hash_mask) > - *_hash_mask = (1 << log2qty) - 1; > + *_hash_mask = (1U << log2qty) - 1; > > return table; > } > -- > 2.43.0 > -- Sincerely yours, Mike.