On Fri, Apr 29, 2022 at 10:22:03PM +0800, zhenwei pi wrote: > clear_hwpoisoned_pages() clears HWPoison flag and decreases the number > of poisoned pages, this actually works as part of memory failure. > > Move this function from sparse.c to memory-failure.c, finally there > is no CONFIG_MEMORY_FAILURE in sparse.c. > > Cc: Wu Fengguang <fengguang.wu@xxxxxxxxx> > Signed-off-by: zhenwei pi <pizhenwei@xxxxxxxxxxxxx> > --- > mm/internal.h | 11 +++++++++++ > mm/memory-failure.c | 21 +++++++++++++++++++++ > mm/sparse.c | 27 --------------------------- > 3 files changed, 32 insertions(+), 27 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index cf16280ce132..e8add8df4e0f 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -758,4 +758,15 @@ struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags); > > DECLARE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); > > +/* > + * mm/memory-failure.c > + */ > +#ifdef CONFIG_MEMORY_FAILURE > +void clear_hwpoisoned_pages(struct page *memmap, int nr_pages); > +#else > +static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) > +{ > +} > +#endif This code may be put near the definitions of hwpoison_filter* in mm/internal.h because they are also called from mm/memory-failure. Otherwise, looks good to me. Acked-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>