All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hirotaka Yamagata" <hiro@pisnp.net>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <liam@infradead.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Chris Li" <chrisl@kernel.org>,
	"Kairui Song" <kasong@tencent.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org,
	"John Stultz" <jstultz@google.com>,
	"Minchan Kim" <minchan@kernel.org>,
	"Alexandre Marciano Gimenez" <raging@google.com>,
	"Tatsuyuki Ishi" <ishitatsuyuki@google.com>,
	tj@kernel.org, mkoutny@suse.com
Subject: Re: [RFC PATCH v1 1/4] mm: introduce VM_VOLATILE and MADV_VOLATILE/MADV_NONVOLATILE VMA handling
Date: Tue, 01 Dec 2026 08:36:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-242853@kernel.org> (raw)
In-Reply-To: <20261130083407.2669584-2-hiro@pisnp.net>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] mm: missing MADV_VOLATILE UAPI definitions on alpha, mips,
  parisc, xtensa
- [Low] mm: madvise_behavior_valid() accepts MADV_VOLATILE on
  !CONFIG_64BIT
--

commit ab93af5a4c34f06ecde808f11b3ce153dea7ddf6
Author: Hirotaka Yamagata <hiro@pisnp.net>

mm: introduce VM_VOLATILE and MADV_VOLATILE/MADV_NONVOLATILE VMA handling

This commit introduces the VM_VOLATILE VMA flag on 64-bit architectures and
adds VMA handling for the MADV_VOLATILE and MADV_NONVOLATILE madvise()
behaviors.

Link: https://lore.kernel.org/1398806483-19122-1-git-send-email-john.stultz@linaro.org

> diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
> index ef1c27fa3c570..cfaa94aea62af 100644
> --- a/include/uapi/asm-generic/mman-common.h
> +++ b/include/uapi/asm-generic/mman-common.h
> @@ -79,6 +79,9 @@
>  
>  #define MADV_COLLAPSE	25		/* Synchronous hugepage collapse */
>  
> +#define MADV_VOLATILE	26		/* Mark pages as volatile */
> +#define MADV_NONVOLATILE 27		/* Mark pages non-volatile, report if purged */
> +
>  #define MADV_GUARD_INSTALL 102		/* fatal signal on access to range */
>  #define MADV_GUARD_REMOVE 103		/* unguard range */

[Severity: High]
Should MADV_VOLATILE and MADV_NONVOLATILE also be defined in the
arch-specific UAPI asm/mman.h headers for alpha, mips, parisc and xtensa?

Those four architectures define their MADV_* constants directly rather than
including asm-generic/mman-common.h, while mm/madvise.c and mm/mvolatile.c
reference MADV_VOLATILE and MADV_NONVOLATILE unconditionally, causing the
build to fail on alpha, mips, parisc and xtensa.

> diff --git a/mm/madvise.c b/mm/madvise.c
> index 96f2387b2f46d..d9d9d5a7221fa 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
[ ... ]
> @@ -1548,6 +1549,8 @@ madvise_behavior_valid(int behavior)
>  	case MADV_KEEPONFORK:
>  	case MADV_GUARD_INSTALL:
>  	case MADV_GUARD_REMOVE:
> +	case MADV_VOLATILE:
> +	case MADV_NONVOLATILE:
>  #ifdef CONFIG_MEMORY_FAILURE
>  	case MADV_SOFT_OFFLINE:
>  	case MADV_HWPOISON:

[Severity: Low]
Should MADV_VOLATILE and MADV_NONVOLATILE in madvise_behavior_valid() be
guarded by #ifdef CONFIG_64BIT?

On 32-bit kernels where volatile ranges are unsupported, do_madvise() checks
if (error || !len_in) return error; before reaching the !CONFIG_64BIT
madvise_volatile() stub, so a zero-length madvise(addr, 0, MADV_VOLATILE)
call returns 0 instead of -EINVAL.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130083407.2669584-1-hiro@pisnp.net?part=1

  reply	other threads:[~2026-12-01  8:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  8:34 [RFC PATCH v1 0/4] mm: port MADV_VOLATILE and MADV_NONVOLATILE to v7.3-rc1 Hirotaka Yamagata
2026-11-30  8:34 ` [RFC PATCH v1 1/4] mm: introduce VM_VOLATILE and MADV_VOLATILE/MADV_NONVOLATILE VMA handling Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot [this message]
2026-12-01 12:40   ` Hirotaka Yamagata
2026-11-30  8:34 ` [RFC PATCH v1 2/4] mm: add PTE_MARKER_PURGED and TTU_PURGE for purged volatile pages Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30  8:34 ` [RFC PATCH v1 3/4] mm/volatile: purge volatile anonymous folios during reclaim Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30  8:34 ` [RFC PATCH v1 4/4] mm/volatile: add PGPURGE vmstat counter and purge tracepoint Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30 10:39 ` [RFC PATCH v1 0/4] mm: port MADV_VOLATILE and MADV_NONVOLATILE to v7.3-rc1 David Hildenbrand (Arm)
2026-11-30 18:18   ` Lorenzo Stoakes (ARM)

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=sashiko-outbox-242853@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hiro@pisnp.net \
    --cc=ishitatsuyuki@google.com \
    --cc=jstultz@google.com \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=minchan@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=raging@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.