Re: [PATCH v6 5/6] tools/mm: make gup_bench a benchmark only tool

Mike Rapoport <[email protected]>
Newsgroups gmane.linux.documentation,gmane.linux.kernel.mm,gmane.linux.kernel
Message-ID <[email protected]>
Hi Sarthak,

On Tue, Aug 04, 2026 at 01:04:13PM +0530, Sarthak Sharma wrote:
> Hi Mike!
> 
> On 8/3/26 2:30 PM, Mike Rapoport wrote:
> >  
> > And the limit checks seem wierd all over the place, like if we can loop
> > infinitely, why do we care about INT_MAX?
> 
> INT_MAX checks are there since nr_pages, nthreads and repeats are stored
> as int.
> 
> But yes I can keep the parameters which are not there in the ioctl ABI
> to be unsigned long, so these checks won't be required there.
> > 
> > And what exact limit ULONG_MAX / MB or SIZE_MAX / sizeof(ptread_t) are
> > supposed to express?
> 
> ULONG_MAX / MB prevents size *= MB from overflowing. SIZE_MAX /
> sizeof(ptread_t) prevents thread array allocation size from overflowing.

To me these checks seem overprotective from one side and not actually
serving a real purpose from the other.

Like e.g. requesting INT_MAX - 1 pages passes the check but it means almost 8TB
of memory and that's really wild.

I'd say let's keep things simple and if a user is stupid enough to run this
with peculiar command line just let it crash.

-- 
Sincerely yours,
Mike.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.