From patchwork Sun Dec 1 01:57:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11268463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B6F117F0 for ; Sun, 1 Dec 2019 01:57:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F308215F1 for ; Sun, 1 Dec 2019 01:57:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZQYSm60I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F308215F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 496546B0381; Sat, 30 Nov 2019 20:57:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 446FD6B0384; Sat, 30 Nov 2019 20:57:45 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 382E36B0385; Sat, 30 Nov 2019 20:57:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 1EA966B0381 for ; Sat, 30 Nov 2019 20:57:45 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id CB0ED2C0C for ; Sun, 1 Dec 2019 01:57:44 +0000 (UTC) X-FDA: 76214911248.01.shape68_4397eb6b28919 X-Spam-Summary: 2,0,0,18e368f94197cbb9,d41d8cd98f00b204,akpm@linux-foundation.org,:akpm@linux-foundation.org:hushiyuan@huawei.com:jack@suse.cz:jgg@ziepe.ca:linfeilong@huawei.com::mhocko@suse.com:minchan@kernel.org:mm-commits@vger.kernel.org:peterz@infradead.org:rientjes@google.com:rppt@linux.ibm.com:torvalds@linux-foundation.org:yeyunfeng@huawei.com,RULES_HIT:41:355:379:800:960:967:973:988:989:1260:1263:1345:1381:1431:1437:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2525:2553:2559:2563:2682:2685:2693:2731:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3868:3870:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:5007:6261:6653:6737:7576:8603:9025:9545:10004:11026:11257:11473:11658:11914:12043:12048:12114:12297:12438:12517:12519:12679:12783:13069:13255:13311:13357:13846:14096:14181:14384:14721:14849:21080:21451:21627:21809:21939:30054:30090,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SP X-HE-Tag: shape68_4397eb6b28919 X-Filterd-Recvd-Size: 3331 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:57:44 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36BC720873; Sun, 1 Dec 2019 01:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575165463; bh=HRgs0zNdmd4j/EEgkwNVV1vqEorM5hljuy9FBmeAnAY=; h=Date:From:To:Subject:From; b=ZQYSm60IdwF2VkZAHg9ZRGpJ7nxSwgZfQA2hNxtXz/WioTuIX0b4Fyz0j1PRmUFZS mEsdBfoiPyhIRTH8BfBVOaEmpiwzDJWh/Rwb/0J0DMovsSaafBIZWKhh00ZTR1bmyl j9mCmR68Ev7Z3U3vg+MfS8/tuQfRMYA5evXHOCuU= Date: Sat, 30 Nov 2019 17:57:42 -0800 From: akpm@linux-foundation.org To: akpm@linux-foundation.org, hushiyuan@huawei.com, jack@suse.cz, jgg@ziepe.ca, linfeilong@huawei.com, linux-mm@kvack.org, mhocko@suse.com, minchan@kernel.org, mm-commits@vger.kernel.org, peterz@infradead.org, rientjes@google.com, rppt@linux.ibm.com, torvalds@linux-foundation.org, yeyunfeng@huawei.com Subject: [patch 143/158] mm/madvise.c: replace with page_size() in madvise_inject_error() Message-ID: <20191201015742.tXGpYlwt0%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: Yunfeng Ye Subject: mm/madvise.c: replace with page_size() in madvise_inject_error() page_size() is supported after the commit a50b854e073c ("mm: introduce page_size()"). Use page_size() in madvise_inject_error() for readability. [akpm@linux-foundation.org: use ulong for `size', per David] Link: http://lkml.kernel.org/r/29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com Signed-off-by: Yunfeng Ye Reviewed-by: Andrew Morton Acked-by: David Rientjes Cc: Jason Gunthorpe Cc: Michal Hocko Cc: Minchan Kim Cc: Peter Zijlstra Cc: Jan Kara Cc: Mike Rapoport Cc: Hu Shiyuan Cc: Feilong Lin Signed-off-by: Andrew Morton --- mm/madvise.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/madvise.c~mm-madvise-replace-with-page_size-in-madvise_inject_error +++ a/mm/madvise.c @@ -864,13 +864,13 @@ static int madvise_inject_error(int beha { struct page *page; struct zone *zone; - unsigned int order; + unsigned long size; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - for (; start < end; start += PAGE_SIZE << order) { + for (; start < end; start += size) { unsigned long pfn; int ret; @@ -882,9 +882,9 @@ static int madvise_inject_error(int beha /* * 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);