lkml.org 
[lkml]   [2019]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/madvise: replace with page_size() in madvise_inject_error()
On Wed, 6 Nov 2019, Yunfeng Ye wrote:

> The function page_size() is supported after the commit a50b854e073c
> ("mm: introduce page_size()").
>
> Replace with page_size() in madvise_inject_error() for readability.
>
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> ---
> mm/madvise.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 2be9f3fdb05e..38c4e7fcf850 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -856,13 +856,13 @@ static int madvise_inject_error(int behavior,
> {
> struct page *page;
> struct zone *zone;
> - unsigned int order;
> + unsigned int size;

Should be unsinged long.

>
> if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
>
>
> - for (; start < end; start += PAGE_SIZE << order) {
> + for (; start < end; start += size) {
> unsigned long pfn;
> int ret;
>
> @@ -874,9 +874,9 @@ static int madvise_inject_error(int behavior,
> /*
> * When soft offlining hugepages, after migrating the page
> * we dissolve it, therefore in the second loop "page" will
> - * no longer be a compound page, and order will be 0.
> + * no longer be a compound page.
> */
> - order = compound_order(compound_head(page));
> + size = page_size(compound_head(page));
>
> if (PageHWPoison(page)) {
> put_page(page);

\
 
 \ /
  Last update: 2019-11-06 22:29    [W:0.078 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site