Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp340051ybx; Wed, 6 Nov 2019 18:08:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzD1+tEuhuBeTzqA+Q7wKJX2dwMQQpal5RyrmMWV1VXqNTIeRXvSCR5Ng7xwAwZYxjJ+TS7 X-Received: by 2002:a05:6402:8cb:: with SMTP id d11mr957545edz.303.1573092495896; Wed, 06 Nov 2019 18:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573092495; cv=none; d=google.com; s=arc-20160816; b=w0reUw9AWpp1/0649st+XtYPcxqriB+EUr8z8iaTI3jgiJMjZphs0FJ+Wgeoy3/lAq Wz5e/posNZstMiMpPH5eu9jM3gaO3WGGOgk+LJ+lE6E9bDQSGXRZ3IHdr2skxj3kbZR3 r8HqoQAPiDl+HP7w5x4NI0RfnX+UTJ4RnFOkAAt2cmc/b4mWQZBLC4dTGY36fo2uJQSe 9kSDID+z5+tMAz1/HyApM8x4gkMysLjOm3gxxg3ZCT7fYckb6LnelKp7rTn/Ee8kf7Ve gW3NE7xU0dwzKXu6uQ/NgP4h157ZytIzQdZcRraJp2YCpZ1dhcfJgBIL4xf8kD9lEvcc 1a9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=qiIUqQNS1mwYEl5TFzTxsyOXwFEyF2gLnQCKAMKaGNQ=; b=ZLOYY8yWcxLhO+RChUnOy6NE7Httf5sNddE88p6g1oCrPaIJef1pi2k4mgI9rBAhdv fGZB3kroFYcMLxBz4W7A+UhQun4l882+0J+9zc1y9MA1j9ePoiOBLMbPhLD/UTrV+FpI yZBduzq3o3hrpHQLwHuZm7WYJABgCVuW7EYF20lSEYYeQGIXIGoA7vsDQxi6e7vCrJzv Q47C54FDOLOcMTdm6UuElWb/Ig/ciDJVI6ww2biz/HhLoD9yxama8LPxm0Gl45CZghDt t8wtKsBpXkPzZA81gHqishYa4FYzNe/HXj9pW2CfAC8TVctlofJRxLKg9g/Q2PgDajiv MqmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15si502305ejd.74.2019.11.06.18.07.52; Wed, 06 Nov 2019 18:08:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732916AbfKGCGd (ORCPT + 99 others); Wed, 6 Nov 2019 21:06:33 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38804 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728021AbfKGCGc (ORCPT ); Wed, 6 Nov 2019 21:06:32 -0500 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > > . >