From: Jiaqi Yan <jiaqiyan@google.com>
To: David Rientjes <rientjes@google.com>
Cc: nao.horiguchi@gmail.com, linmiaohe@huawei.com,
jane.chu@oracle.com, rdunlap@infradead.org, ioworker0@gmail.com,
muchun.song@linux.dev, akpm@linux-foundation.org,
shuah@kernel.org, corbet@lwn.net, osalvador@suse.de,
duenwen@google.com, fvdl@google.com, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v6 2/4] mm/memory-failure: userspace controls soft-offlining pages
Date: Fri, 28 Jun 2024 10:05:34 -0700 [thread overview]
Message-ID: <CACw3F53LoA_4PPxUdTYFzEdxOkAPJWBRp1mx9JafybZYvCYBLQ@mail.gmail.com> (raw)
In-Reply-To: <e61fa5ea-09f3-c5f4-96be-ab0c5e7b233e@google.com>
On Thu, Jun 27, 2024 at 8:27 PM David Rientjes <rientjes@google.com> wrote:
>
> On Wed, 26 Jun 2024, Jiaqi Yan wrote:
>
> > diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> > index 6f5ac334efba..1559e773537f 100644
> > --- a/mm/memory-failure.c
> > +++ b/mm/memory-failure.c
> > @@ -68,6 +68,8 @@ static int sysctl_memory_failure_early_kill __read_mostly;
> >
> > static int sysctl_memory_failure_recovery __read_mostly = 1;
> >
> > +static int sysctl_enable_soft_offline __read_mostly = 1;
> > +
> > atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0);
> >
> > static bool hw_memory_failure __read_mostly = false;
> > @@ -141,6 +143,15 @@ static struct ctl_table memory_failure_table[] = {
> > .extra1 = SYSCTL_ZERO,
> > .extra2 = SYSCTL_ONE,
> > },
> > + {
> > + .procname = "enable_soft_offline",
> > + .data = &sysctl_enable_soft_offline,
> > + .maxlen = sizeof(sysctl_enable_soft_offline),
> > + .mode = 0644,
> > + .proc_handler = proc_dointvec_minmax,
> > + .extra1 = SYSCTL_ZERO,
> > + .extra2 = SYSCTL_ONE,
> > + }
> > };
> >
> > /*
> > @@ -2749,8 +2760,9 @@ static int soft_offline_in_use_page(struct page *page)
> > * @pfn: pfn to soft-offline
> > * @flags: flags. Same as memory_failure().
> > *
> > - * Returns 0 on success
> > - * -EOPNOTSUPP for hwpoison_filter() filtered the error event
> > + * Returns 0 on success,
> > + * -EOPNOTSUPP for hwpoison_filter() filtered the error event, or
> > + * disabled by /proc/sys/vm/enable_soft_offline,
> > * < 0 otherwise negated errno.
> > *
> > * Soft offline a page, by migration or invalidation,
> > @@ -2786,6 +2798,13 @@ int soft_offline_page(unsigned long pfn, int flags)
> > return -EIO;
> > }
> >
> > + if (!sysctl_enable_soft_offline) {
> > + pr_info_once("%#lx: disabled by /proc/sys/vm/enable_soft_offline\n",
> > + pfn);
>
> Any strong reason to include the pfn in the log message?
>
> I'm concerned about allowing a user to deduce the physical mapping for any
> arbitrary page since this is possible to do through MADV_SOFT_OFFLINE and
> I don't think that it adds value, especially if this is pr_info_once().
Agreed printing pfn value doesn't add value. Will get rid of it in v7.
>
> If we remove the pfn, feel free to add
>
> Acked-by: David Rientjes <rientjes@google.com>
Thanks David!
>
> > + put_ref_page(pfn, flags);
> > + return -EOPNOTSUPP;
> > + }
> > +
> > mutex_lock(&mf_mutex);
> >
> > if (PageHWPoison(page)) {
> > --
> > 2.45.2.741.gdbec12cfda-goog
> >
> >
next prev parent reply other threads:[~2024-06-28 17:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 5:08 [PATCH v6 0/4] Userspace controls soft-offline pages Jiaqi Yan
2024-06-26 5:08 ` [PATCH v6 1/4] mm/memory-failure: refactor log format in soft offline code Jiaqi Yan
2024-06-26 5:08 ` [PATCH v6 2/4] mm/memory-failure: userspace controls soft-offlining pages Jiaqi Yan
2024-06-28 3:27 ` David Rientjes
2024-06-28 17:05 ` Jiaqi Yan [this message]
2024-06-26 5:08 ` [PATCH v6 3/4] selftest/mm: test enable_soft_offline behaviors Jiaqi Yan
2024-06-28 3:29 ` Miaohe Lin
2024-06-28 17:25 ` Jiaqi Yan
2024-06-26 5:08 ` [PATCH v6 4/4] docs: mm: add enable_soft_offline sysctl Jiaqi Yan
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=CACw3F53LoA_4PPxUdTYFzEdxOkAPJWBRp1mx9JafybZYvCYBLQ@mail.gmail.com \
--to=jiaqiyan@google.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=duenwen@google.com \
--cc=fvdl@google.com \
--cc=ioworker0@gmail.com \
--cc=jane.chu@oracle.com \
--cc=linmiaohe@huawei.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=rdunlap@infradead.org \
--cc=rientjes@google.com \
--cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).