From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 945A9FA372C for ; Thu, 7 Nov 2019 02:06:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5364A2187F for ; Thu, 7 Nov 2019 02:06:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5364A2187F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D7C406B0003; Wed, 6 Nov 2019 21:06:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D2C4C6B0006; Wed, 6 Nov 2019 21:06:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C422F6B0007; Wed, 6 Nov 2019 21:06:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id AF4626B0003 for ; Wed, 6 Nov 2019 21:06:36 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 611032C94 for ; Thu, 7 Nov 2019 02:06:36 +0000 (UTC) X-FDA: 76127842392.13.eggs86_397eccf886038 X-HE-Tag: eggs86_397eccf886038 X-Filterd-Recvd-Size: 3184 Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Nov 2019 02:06:34 +0000 (UTC) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id CC94F4185908B1A79E1D; Thu, 7 Nov 2019 10:06:29 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Thu, 7 Nov 2019 10:06:17 +0800 Subject: Re: [PATCH] mm/madvise: replace with page_size() in madvise_inject_error() To: David Rientjes CC: , , , , , , , , , , "hushiyuan@huawei.com" , "linfeilong@huawei.com" References: <29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com> From: Yunfeng Ye Message-ID: <7296c9ca-f8a7-f31b-d090-cc6bf5ee1df4@huawei.com> Date: Thu, 7 Nov 2019 10:05:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2019/11/7 5:28, David Rientjes wrote: > 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 >> --- >> 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. > ok, thanks. Andrew has already help me modify the patch and add to -mm tree. >> >> 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); > > . >