Re: [PATCH 05/10] mm: remove flag argument from soft offline functions

From: David Hildenbrand
Date: Wed Sep 11 2019 - 06:24:32 EST


On 10.09.19 12:30, Oscar Salvador wrote:
> From: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
>
> The argument @flag no longer affects the behavior of soft_offline_page()
> and its variants, so let's remove them.
>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> ---
> drivers/base/memory.c | 2 +-
> include/linux/mm.h | 2 +-
> mm/madvise.c | 2 +-
> mm/memory-failure.c | 27 +++++++++++++--------------
> 4 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 6bea4f3f8040..e5485c22ef77 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -540,7 +540,7 @@ static ssize_t soft_offline_page_store(struct device *dev,
> pfn >>= PAGE_SHIFT;
> if (!pfn_valid(pfn))
> return -ENXIO;
> - ret = soft_offline_page(pfn_to_page(pfn), 0);
> + ret = soft_offline_page(pfn_to_page(pfn));
> return ret == 0 ? count : ret;
> }
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index fb36a4165a4e..3cc800d9f57a 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2827,7 +2827,7 @@ extern int sysctl_memory_failure_early_kill;
> extern int sysctl_memory_failure_recovery;
> extern void shake_page(struct page *p, int access);
> extern atomic_long_t num_poisoned_pages __read_mostly;
> -extern int soft_offline_page(struct page *page, int flags);
> +extern int soft_offline_page(struct page *page);
>
>
> /*
> diff --git a/mm/madvise.c b/mm/madvise.c
> index fbe6d402232c..ece128211400 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -906,7 +906,7 @@ static int madvise_inject_error(int behavior,
> pr_info("Soft offlining pfn %#lx at process virtual address %#lx\n",
> pfn, start);
>
> - ret = soft_offline_page(page, 0);
> + ret = soft_offline_page(page);
> if (ret)
> return ret;
> continue;
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 1be785b25324..5071d39bdfef 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1478,7 +1478,7 @@ static void memory_failure_work_func(struct work_struct *work)
> if (!gotten)
> break;
> if (entry.flags & MF_SOFT_OFFLINE)
> - soft_offline_page(pfn_to_page(entry.pfn), entry.flags);
> + soft_offline_page(pfn_to_page(entry.pfn));
> else
> memory_failure(entry.pfn, entry.flags);
> }
> @@ -1611,7 +1611,7 @@ static struct page *new_page(struct page *p, unsigned long private)
> * that is not free, and 1 for any other page type.
> * For 1 the page is returned with increased page count, otherwise not.
> */
> -static int __get_any_page(struct page *p, unsigned long pfn, int flags)
> +static int __get_any_page(struct page *p, unsigned long pfn)
> {
> int ret;
>
> @@ -1638,9 +1638,9 @@ static int __get_any_page(struct page *p, unsigned long pfn, int flags)
> return ret;
> }
>
> -static int get_any_page(struct page *page, unsigned long pfn, int flags)
> +static int get_any_page(struct page *page, unsigned long pfn)
> {
> - int ret = __get_any_page(page, pfn, flags);
> + int ret = __get_any_page(page, pfn);
>
> if (ret == 1 && !PageHuge(page) &&
> !PageLRU(page) && !__PageMovable(page)) {
> @@ -1653,7 +1653,7 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
> /*
> * Did it turn free?
> */
> - ret = __get_any_page(page, pfn, 0);
> + ret = __get_any_page(page, pfn);
> if (ret == 1 && !PageLRU(page)) {
> /* Drop page reference which is from __get_any_page() */
> put_hwpoison_page(page);
> @@ -1665,7 +1665,7 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
> return ret;
> }
>
> -static int soft_offline_huge_page(struct page *page, int flags)
> +static int soft_offline_huge_page(struct page *page)
> {
> int ret;
> unsigned long pfn = page_to_pfn(page);
> @@ -1724,7 +1724,7 @@ static int soft_offline_huge_page(struct page *page, int flags)
> return ret;
> }
>
> -static int __soft_offline_page(struct page *page, int flags)
> +static int __soft_offline_page(struct page *page)
> {
> int ret;
> unsigned long pfn = page_to_pfn(page);
> @@ -1804,7 +1804,7 @@ static int __soft_offline_page(struct page *page, int flags)
> return ret;
> }
>
> -static int soft_offline_in_use_page(struct page *page, int flags)
> +static int soft_offline_in_use_page(struct page *page)
> {
> int ret;
> int mt;
> @@ -1834,9 +1834,9 @@ static int soft_offline_in_use_page(struct page *page, int flags)
> mt = get_pageblock_migratetype(page);
> set_pageblock_migratetype(page, MIGRATE_ISOLATE);
> if (PageHuge(page))
> - ret = soft_offline_huge_page(page, flags);
> + ret = soft_offline_huge_page(page);
> else
> - ret = __soft_offline_page(page, flags);
> + ret = __soft_offline_page(page);
> set_pageblock_migratetype(page, mt);
> return ret;
> }
> @@ -1857,7 +1857,6 @@ static int soft_offline_free_page(struct page *page)
> /**
> * soft_offline_page - Soft offline a page.
> * @page: page to offline
> - * @flags: flags. Same as memory_failure().
> *
> * Returns 0 on success, otherwise negated errno.
> *
> @@ -1876,7 +1875,7 @@ static int soft_offline_free_page(struct page *page)
> * This is not a 100% solution for all memory, but tries to be
> * ``good enough'' for the majority of memory.
> */
> -int soft_offline_page(struct page *page, int flags)
> +int soft_offline_page(struct page *page)
> {
> int ret;
> unsigned long pfn = page_to_pfn(page);
> @@ -1893,11 +1892,11 @@ int soft_offline_page(struct page *page, int flags)
> }
>
> get_online_mems();
> - ret = get_any_page(page, pfn, flags);
> + ret = get_any_page(page, pfn);
> put_online_mems();
>
> if (ret > 0)
> - ret = soft_offline_in_use_page(page, flags);
> + ret = soft_offline_in_use_page(page);
> else if (ret == 0)
> ret = soft_offline_free_page(page);
>
>

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--

Thanks,

David / dhildenb