Re: [PATCH v3 1/3] mm/memory-failure: userspace controls soft-offlining pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 18, 2024 at 10:03 PM Oscar Salvador <osalvador@xxxxxxx> wrote:
>
> On Mon, Jun 17, 2024 at 05:05:43PM +0000, Jiaqi Yan wrote:
> > - * Returns 0 on success
> > - *         -EOPNOTSUPP for hwpoison_filter() filtered the error event
> > + * Returns 0 on success,
> > + *         -EOPNOTSUPP for hwpoison_filter() filtered the error event,
> > + *         -EOPNOTSUPP if disabled by /proc/sys/vm/enable_soft_offline,
> >   *         < 0 otherwise negated errno.
> >   *
> >   * Soft offline a page, by migration or invalidation,
> > @@ -2783,6 +2795,12 @@ int soft_offline_page(unsigned long pfn, int flags)
> >               return -EIO;
> >       }
> >
> > +     if (!sysctl_enable_soft_offline) {
> > +             pr_info("%#lx: OS-wide disabled\n", pfn);
> > +             put_ref_page(pfn, flags);
> > +             return -EOPNOTSUPP;
> > +     }
>
> We should not be doing anything if soft_offline is disabled, so this check should
> be placed upfront, at the very beginning of the function.
> Then you can remove the 'put_ref_page' call.

I think if MF_COUNT_INCREASED is in flags, we still need to
put_ref_page(), right?

>
>
> --
> Oscar Salvador
> SUSE Labs





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux