lkml.org 
[lkml]   [2023]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/vmalloc: Replace the ternary conditional operator with min()
On Sat, Jun 10, 2023 at 03:08:09PM -0700, Andrew Morton wrote:
> On Sat, 10 Jun 2023 22:06:35 +0100 Lorenzo Stoakes <lstoakes@gmail.com> wrote:
>
> > > > OK, as per the pedantic test bot, you'll need to change this to:-
> > > >
> > > > num = min_t(size_t, remains, PAGE_SIZE);
>
> PAGE_SIZE is a nuisance. It _usually_ creates the need for a
> cast:
>
> hp2:/usr/src/linux-6.4-rc4> grep -r "min(.*PAGE_SIZE" . | wc -l
> 117
> hp2:/usr/src/linux-6.4-rc4> grep -r "min_t(.*PAGE_SIZE" . | wc -l
> 279
>
> Perhaps it should always have been size_t.
>

I mean I absolutely agree this not being size_t is a bit silly although I'm
pretty convinced sizeof(size_t) == sizeof(unsigned long) in all kernel
arches (correct me if I'm wrong).

So I'd not be against this at all :)

> I suppose we could do
>
> #define PAGE_SIZE_T (size_t)PAGE_SIZE
>
> And use that where needed. Mainly because I like the name ;)

I'm not sure I love that name :P but it is kind of cute I guess!

\
 
 \ /
  Last update: 2023-06-11 00:24    [W:0.209 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site