Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp76721ybx; Wed, 6 Nov 2019 13:29:36 -0800 (PST) X-Google-Smtp-Source: APXvYqx69qEGfs+h4dDStCcIAuDa9KBI6bfO4CCKw2P0xQrSQP1xpmSTiLTa5HvSk2fG2Nxm/d9W X-Received: by 2002:a50:950a:: with SMTP id u10mr5301050eda.68.1573075776737; Wed, 06 Nov 2019 13:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573075776; cv=none; d=google.com; s=arc-20160816; b=zpSBLwvLkRky/aGJlN51ELHqfsLCMbXGZ42DfklfH7s7HEsVpqToem9ed8z/AhuB0K V9eDnbp2h/cZr5MVv6uWmNR7iHMjwGErJI1ikTtDTd7VU4JOi28rtqU+I/1cA0AvxVmB Ar+SszgtKB9CMKfEEjxkeEUen0mTypJX0DQOfOUmmBpAFACfI7JPWTbmiknP8uunolmJ w/rv4t4lhJAhllE+vhMa4zuj4E5GnCin8vKOySxS0EwjJKfP/OIbd7GZ4uCYi7Fb/aUf HVaFbSB495IUsu0DrkXu0DoRXcf3oVxMnrZ2kxRsU2pkd1MmI1a3Lzl1SFtMXDFevjSr c09Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=krzOUvpi1e5/wmoRaiU4lZEs6DtCOLGJs0yJ4n3NiT4=; b=PvwhOs96/ThEe4HPfqW9SIrzkhRMjsDALhIXkZimiX/ZpuoMZ3RrTjUpOZLhbx+LYQ vLrn14b/tigbtZ62dHGHxOMrMqKKKbqVb/Pbng7HDV9/FYS8V+MKJUsNdOzPzJn1Xs0x +r2WXLnXYO3kv0QJoRgmriZqvAiMWBKIWOZ+gjZModCW5BaFNmUdgjQ2Ex1wuxseG27B MCR2uWB8rLDOSe1KdOanC4aODJxWl49/VFaJ9hYMtmW7yUMXHgEjfGqBfvvBqYjdtApX TbD+hnTUKqBO1g0AJiW3oWYoyQhTvYDMD5b/D93taxI5MbyNhhbhzr+OQiOd70hkIfkv tjUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sbLfgdAS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si84509ejx.212.2019.11.06.13.29.12; Wed, 06 Nov 2019 13:29:36 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=sbLfgdAS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728002AbfKFV2O (ORCPT + 99 others); Wed, 6 Nov 2019 16:28:14 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39755 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfKFV2O (ORCPT ); Wed, 6 Nov 2019 16:28:14 -0500 Received: by mail-pf1-f196.google.com with SMTP id x28so16720629pfo.6 for ; Wed, 06 Nov 2019 13:28:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=krzOUvpi1e5/wmoRaiU4lZEs6DtCOLGJs0yJ4n3NiT4=; b=sbLfgdAS6EOV//l2R1R1T6k78DSCdQF5xOe10EZQffA6kEO8JX0b9A6OzeFmsYBnoC 23KagORrktTZpPVwwaCyV1orBrqH+flbaUSwFmG/Na4NbuUuK8d8E1yPR3ke00MkQpDm vFsu6+fRKoUkbD3ObCzkSvrz6TmMUisT8ALkgNTBj/csrl0GuHqKje8O63ZnL1wSi8y9 v27nd3z2u4OiwuIrfffOp5Tg0s2umO4xYWoioIeKCoupHnWl2h8psosdgZI2drwsz39Z us48CeWvOT/4/BvzO++HlV6lrdgm2x91NM9tq03NQkAef3CskGnb9I1sp3ww3M74m+9U T14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=krzOUvpi1e5/wmoRaiU4lZEs6DtCOLGJs0yJ4n3NiT4=; b=DFFu11d5FGFzXbQ59p3lSlkWDWOcbQuouqbUuzcF+ZqFksF97gQt1H2VCSnHaCRaJg UBgaImYTdgrXyR/uw8i7BWo0A5wnMArOPMlsONnHMZFgLJjypD97pwlDl/WVv8/lH1NT AdKxQH7tg+dKVhAeVSlQPBZAwmXcXZ//X7ZFzkfxrXUSt8Fnlj7g5i8/VPXZBZw0gQIm 0JEBS9t8qqEFEBrPF9of7WERnx/C5kfw5AzOUauHsN9YZ2Yu9bYl25YQNRD5solAwWua 8Zvtx0Kep9XPw34X3NQgaz+ErXJHpnm3IPkDw9ufeT9dqJg7DFZ1yl8s43VzYcKJ3GUp cmuQ== X-Gm-Message-State: APjAAAXtyNisspLkZJTTJThh43wsn0eeL8Mk38aRXLDHcg/CfANI5ylj oJpDuZjMW/63t4Wrquh8QmHYIA== X-Received: by 2002:a62:180a:: with SMTP id 10mr6155357pfy.40.1573075693388; Wed, 06 Nov 2019 13:28:13 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id y138sm26034618pfb.174.2019.11.06.13.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 13:28:12 -0800 (PST) Date: Wed, 6 Nov 2019 13:28:11 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Yunfeng Ye cc: akpm@linux-foundation.org, jgg@ziepe.ca, mhocko@suse.com, jglisse@redhat.com, minchan@kernel.org, peterz@infradead.org, jack@suse.cz, rppt@linux.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "hushiyuan@huawei.com" , "linfeilong@huawei.com" Subject: Re: [PATCH] mm/madvise: replace with page_size() in madvise_inject_error() In-Reply-To: <29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com> Message-ID: References: <29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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);