From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: hughd@google.com, baolin.wang@linux.alibaba.com,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] shmem: skip empty unmap ranges when punching holes
Date: Wed, 4 Nov 2026 15:05:23 +0100 [thread overview]
Message-ID: <05ecbb76-3496-4985-ac3c-af2185de6f0d@kernel.org> (raw)
In-Reply-To: <CAGEkeHey0fjkgqbrxyW=9JNX1KuD+OWzzEUwi-37ehD+07SR=w@mail.gmail.com>
On 11/3/26 21:00, Hungyu Lin wrote:
>> To be clear, I was asking whether we could do
>>
>> if ((u64)(unmap_end) >= (u64)unmap_start)
>
> Sorry, I misunderstood your suggestion.
>
> With offset = 0 and len = 1, unmap_end is -1 and unmap_start is 0.
> Casting -1 to u64 makes this comparison true, so it still passes
> a zero length to unmap_mapping_range(), meaning unmap to EOF.
loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1;
Yes, that will give us -1. with offset+len == 1.
Makes sense, although it all looks more confusing than it should be :)
I'm fine with the fix, but I do wonder whether we could make unmap_end an
exclusive end instead of an inclusive end ... something for the future.
--
Cheers,
David
prev parent reply other threads:[~2026-11-04 14:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 17:17 Hungyu Lin
2026-10-28 3:02 ` Baolin Wang
2026-11-03 16:08 ` David Hildenbrand (Arm)
2026-11-03 19:38 ` Hungyu Lin
2026-11-03 19:41 ` David Hildenbrand (Arm)
2026-11-03 20:00 ` Hungyu Lin
2026-11-04 14:05 ` David Hildenbrand (Arm) [this message]
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=05ecbb76-3496-4985-ac3c-af2185de6f0d@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dennylin0707@gmail.com \
--cc=hughd@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®