[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <exnrnqek3ktgprxzuf27osu6olcnvjzwdlt23a3mm5y2qstl2t@x4ud2xoyguff>
Date: Wed, 5 Mar 2025 12:25:51 -0800
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: SeongJae Park <sj@...nel.org>
Cc: "Liam R. Howlett" <howlett@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, kernel-team@...a.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC PATCH 01/16] mm/madvise: use is_memory_failure() from
madvise_do_behavior()
On Wed, Mar 05, 2025 at 10:15:56AM -0800, SeongJae Park wrote:
> To reduce redundant open-coded checks of CONFIG_MEMORY_FAILURE and
> MADV_{HWPOISON,SOFT_OFFLINE} in madvise_[un]lock(), is_memory_failure()
> has introduced. madvise_do_behavior() is still doing the same
> open-coded check, though. Use is_memory_failure() instead.
>
> Signed-off-by: SeongJae Park <sj@...nel.org>
> ---
> mm/madvise.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 388dc289b5d1..dbc8fec05cc6 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1640,10 +1640,8 @@ static int madvise_do_behavior(struct mm_struct *mm,
> unsigned long end;
> int error;
>
> -#ifdef CONFIG_MEMORY_FAILURE
> - if (behavior == MADV_HWPOISON || behavior == MADV_SOFT_OFFLINE)
> + if (is_memory_failure(behavior))
> return madvise_inject_error(behavior, start, start + len_in);
You might want to either define empty madvise_inject_error() for
!CONFIG_MEMORY_FAILURE or keep CONFIG_MEMORY_FAILURE here.
> -#endif
> start = untagged_addr_remote(mm, start);
> end = start + len;
>
> --
> 2.39.5
Powered by blists - more mailing lists