From: Mike Rapoport <rppt@kernel.org>
To: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: mm_init: use div64_ul() instead of do_div()
Date: Mon, 1 Jun 2026 14:15:04 +0300 [thread overview]
Message-ID: <ah1puPfob4Ux3BWi@kernel.org> (raw)
In-Reply-To: <20260601121122.94379-2-giorgitchankvetadze1997@gmail.com>
Hi,
On Mon, Jun 01, 2026 at 04:11:23PM +0400, Giorgi Tchankvetadze wrote:
> Fixes Coccinelle/coccicheck warning reported by do_div.cocci.
>
> Compared to do_div(), div64_ul() does not implicitly cast the divisor and
> does not unnecessarily calculate the remainder.
Can you describe what are the actual visible effects?
> Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
> ---
> 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 db5568cf36e1..4d335eb799e6 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -2426,7 +2426,7 @@ void *__init alloc_large_system_hash(const char *tablename,
> /* limit allocation size to 1/16 total memory by default */
> if (max == 0) {
> max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4;
> - do_div(max, bucketsize);
> + max = div64_ul(max, bucketsize);
> }
> max = min(max, 0x80000000ULL);
>
> --
> 2.52.0
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-06-01 11:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 12:11 [PATCH] mm: mm_init: use div64_ul() instead of do_div() Giorgi Tchankvetadze
2026-06-01 11:15 ` Mike Rapoport [this message]
2026-06-01 15:26 ` Giorgi Tchankvetadze
2026-06-01 12:04 ` Mike Rapoport
2026-06-01 15:47 ` Giorgi Tchankvetadze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ah1puPfob4Ux3BWi@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=giorgitchankvetadze1997@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.