Rust for Linux List
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "liujinlong" <liujinlong176@163.com>
Cc: <rust-for-linux@vger.kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"liujinlong" <liujinlong@kylinos.cn>
Subject: Re: [PATCH 1/2] rust: mm: add VmaRef range query helpers
Date: Tue, 11 Aug 2026 21:12:35 +0900	[thread overview]
Message-ID: <DKM3SRUKRG7B.3B9E6YEE9JTST@nvidia.com> (raw)
In-Reply-To: <20260811032603.2651065-1-liujinlong176@163.com>

On Tue Aug 11, 2026 at 12:26 PM JST, liujinlong wrote:
> From: liujinlong <liujinlong@kylinos.cn>
>
> Add helpers on VmaRef to query the virtual address span and test
> address membership:
>
>   len(), is_empty()       - byte span and zero-length check
>   contains()              - single-address membership in
>                            [vm_start, vm_end)
>   contains_range()        - sub-range membership, returns false
>                            on overflow
>   is_page_aligned()       - PAGE_SIZE alignment for one address
>   is_page_aligned_range() - PAGE_SIZE alignment for addr and size
>
> is_page_aligned() and is_page_aligned_range() are associated
> functions rather than methods, since they do not reference any VMA
> state.  They live here instead of a separate utility module to
> keep the page-alignment helpers close to the range-checking code
> that often uses them.
>
> Signed-off-by: liujinlong <liujinlong@kylinos.cn>

I guess a more useful implementation would be to just return a `Range`
of `start..end` and benefit from all its methods, which cover most of
those defined in this patch.

  parent reply	other threads:[~2026-08-11 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  3:26 [PATCH 1/2] rust: mm: add VmaRef range query helpers liujinlong
2026-08-11  3:26 ` [PATCH 2/2] rust: mm: refactor zap_vma_range() to use contains_range() liujinlong
2026-08-11 12:12 ` Alexandre Courbot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-11  3:20 [PATCH 1/2] rust: mm: add VmaRef range query helpers liujinlong

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=DKM3SRUKRG7B.3B9E6YEE9JTST@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=liujinlong176@163.com \
    --cc=liujinlong@kylinos.cn \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /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