linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>, Aristeu Rozanski <aris@ruivo.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: Re: [PATCH] mm: make folio page count functions return unsigned
Date: Wed, 27 Aug 2025 11:14:56 +0200	[thread overview]
Message-ID: <6dd69fbb-b043-4c18-be14-e9f70b6c0c06@redhat.com> (raw)
In-Reply-To: <aK5daUurTM8ET2gf@casper.infradead.org>

On 27.08.25 03:20, Matthew Wilcox wrote:
> On Tue, Aug 26, 2025 at 06:00:41PM -0400, Aristeu Rozanski wrote:
>> some actually expect an int (e.g. memcg1_charge_statistics()), it'd be a good
>> idea to get those fixed.
> 
> Yes.
> 
>>> Then, e.g., -1 will be (unsigned int)0xffffffff, and casting that to
>>> "long" means trouble, because we wouldn't sign-extend properly and get
>>> (long)0x00000000ffffffff.
>>>
>>> Using "unsigned long" instead work perfectly fine.
>>>
>>> e.g., -1 will be (unsigned long)0xffffffffffffffff. Passing that to a
>>> function that expects "long" or "unsigned long" works as expected.
>>
>> We could run into problems if folio_nr_pages() ever returns an unsigned long
>> larger than LONG_MAX :^)
> 
> I feel comfortable saying that we'll never support a folio size larger
> than 2^31 bytes on 32-bit or 2^63 bytes on 64-bit because folio_size()
> returns a size_t so that constrains us.
Right, otherwise we're back in highmem days where "unsigned long pfn" 
works but "unsigned long long size" is required.

(I hope we'll never have to deal with highmem on 6bit :D ... well, and 
that we can get rid of highmem support on 32bit)

-- 
Cheers

David / dhildenb



  reply	other threads:[~2025-08-27  9:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 15:37 Aristeu Rozanski
2025-08-26 19:00 ` Matthew Wilcox
2025-08-26 21:45   ` David Hildenbrand
2025-08-26 22:00     ` Aristeu Rozanski
2025-08-27  1:20       ` Matthew Wilcox
2025-08-27  9:14         ` David Hildenbrand [this message]
2025-08-27  9:13 ` David Hildenbrand

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=6dd69fbb-b043-4c18-be14-e9f70b6c0c06@redhat.com \
    --to=david@redhat.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aris@ruivo.org \
    --cc=linux-mm@kvack.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox