Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1008385ybl; Wed, 14 Aug 2019 09:17:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVHK40ye7x8oJJqtNDH8I43WqfXDtQjuwcezlVhyYquPW+oz3wcRopiS8H4C2emKctB6zQ X-Received: by 2002:a63:2b8e:: with SMTP id r136mr30173pgr.216.1565799443823; Wed, 14 Aug 2019 09:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565799443; cv=none; d=google.com; s=arc-20160816; b=BJ472IqtQ4BK0eSMibqVz0Y1e7gN4lwt6dUCacj4FYudpDGU65MVWBjtU6RVaP+Zid TJBO1wHuFATYesFlj4TCpFIdLq+mV5w1mUx8U0kSVow01UxKW1cmTL5IlpL2a1N1umPt Iwmxs2nhXTqkmb4NCNtj/CPvmgLkMTXsWPD5EPu6JLLTkqbikJ2pPK8ZXqeUaINiTLDn ckyVQVXyQf1yg7jPqtmw2mJC2/7q0nKww0u5aQuL4bfME8Rgbqc2ImWS/6ipSiIl0SBV Eg8TMb5gAIxeANA2OSzU0rD8zFVx0Tpc4zexOWegBiWD67Hon0crhjZG3jWam2Siu3rv W5Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=8o9aIlCo3mpiOSnSj5arXqF2puBzCrXsQ6oC+NpAyV0=; b=hHdW4EzF2e85uDePmHbFEJLunt6z7M2cZZoGTi9h+bswNbbyYgg3xgSgoDwubyrqgq mEM1U2hGmKqw843eda5pdzZR4BehtIBjVSLDGNGHiOMVwX/7MQu/0Dr6kwnSBUHzazGt CbPfbYaJ3grucmPDlcSPCxKE/TWWcWZq2+2nroEjWmeFl4sQu+Ai5xBfCEza2GmpZHAZ wlG+0cSMDbP8JQE3RvdT7m9gkOzCwbEs6OinHlxyaWv2ViClTNYRoGiMahATV+t0TBa2 /4qdTDScGVUOGHhUOhX5jqlE6r7i/ruHCQlciJK+rP3aV8CwitzqnHhDQ1KlsXO5ytiO /RoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tZ+HKRJp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r16si84643pgv.466.2019.08.14.09.17.07; Wed, 14 Aug 2019 09:17:23 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=tZ+HKRJp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728307AbfHNQPp (ORCPT + 99 others); Wed, 14 Aug 2019 12:15:45 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42240 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbfHNQPo (ORCPT ); Wed, 14 Aug 2019 12:15:44 -0400 Received: by mail-ed1-f65.google.com with SMTP id m44so7546072edd.9 for ; Wed, 14 Aug 2019 09:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8o9aIlCo3mpiOSnSj5arXqF2puBzCrXsQ6oC+NpAyV0=; b=tZ+HKRJpMp6FIVMsf7o5+PbNE/FCT6+0SQQSCPqVFcw1JwdH2wCsxVa74p7WBEgC5g jrVqSX3R/MWO7Tm8mrkP0X4znPQCXJ9JFxA887NEMRpu4J/KM9Tr+L1chHpnjsFShhfD kjqzrNxc68sHtN/8jLDDY1fyH2axmJPwxAWrFyrSfuoGL7mRWlJXFROYkaaNWvZWFGUU IdyQ+CskuJCoE+TM3+Af8bUT3Cv0tMVgwlsDId56+UTv9IGyeT1AlWgcdmRwFPZXs/qC 5OJDP0G7gku518XBm35mFw6VAQojAFdgZwmVunnsc8tGwgo7C51wCDlI0JIKZH94IBar zRvg== 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:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=8o9aIlCo3mpiOSnSj5arXqF2puBzCrXsQ6oC+NpAyV0=; b=nwKELMgpQ/NBHTC8QGWHYIUu37GLB8XJ3VP9A42/PzvijA7wRYMRoHAh4RS/XOKDoG ShgLxMoxwLcTABB8C9lqPg0Gh7xX5CKOb6tYnJypRurkY4YQyM0W7WbNr6aXy2cQCrEY +cgpgwDJ7MIxIbN3jCYTh6eL0u50qrkseGZpmSmlHI3EKG3apRoVqO7IXw2SS0ngfATQ sgwcLgz4BGjOuCcLbGtUnosXlFuFVtHTS1UX6w01cIznJ0nwdvDK4ErN/10ySgtmQmbP zWtSq31ebTDC99Lc8yIT44UeBFwT/WKlvUSNujfRgZX2lIZrxZgD4BBwz7O3gzee5mYO KsGQ== X-Gm-Message-State: APjAAAXZa7tli8LUW+u6C2ltgA1JY7C7c0UcWeGy5DedJMrYQbP/JT5W 7ULsO4W+IqbcJuW9zNXHFWs= X-Received: by 2002:a50:b3cb:: with SMTP id t11mr374805edd.203.1565799343284; Wed, 14 Aug 2019 09:15:43 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id e24sm11734ejb.53.2019.08.14.09.15.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Aug 2019 09:15:42 -0700 (PDT) Date: Wed, 14 Aug 2019 16:15:41 +0000 From: Wei Yang To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dan Williams , Borislav Petkov , Andrew Morton , Bjorn Helgaas , Ingo Molnar , Dave Hansen , Nadav Amit , Wei Yang , Oscar Salvador , Michal Hocko Subject: Re: [PATCH v2 1/5] resource: Use PFN_UP / PFN_DOWN in walk_system_ram_range() Message-ID: <20190814161541.ho5b6ju4t23vruff@master> Reply-To: Wei Yang References: <20190814154109.3448-1-david@redhat.com> <20190814154109.3448-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190814154109.3448-2-david@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 05:41:05PM +0200, David Hildenbrand wrote: >This makes it clearer that we will never call func() with duplicate PFNs >in case we have multiple sub-page memory resources. All unaligned parts >of PFNs are completely discarded. > >Cc: Dan Williams >Cc: Borislav Petkov >Cc: Andrew Morton >Cc: Bjorn Helgaas >Cc: Ingo Molnar >Cc: Dave Hansen >Cc: Nadav Amit >Cc: Wei Yang >Cc: Oscar Salvador >Acked-by: Michal Hocko >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > kernel/resource.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/kernel/resource.c b/kernel/resource.c >index 7ea4306503c5..88ee39fa9103 100644 >--- a/kernel/resource.c >+++ b/kernel/resource.c >@@ -487,8 +487,8 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, > while (start < end && > !find_next_iomem_res(start, end, flags, IORES_DESC_NONE, > false, &res)) { >- pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT; >- end_pfn = (res.end + 1) >> PAGE_SHIFT; >+ pfn = PFN_UP(res.start); >+ end_pfn = PFN_DOWN(res.end + 1); > if (end_pfn > pfn) > ret = (*func)(pfn, end_pfn - pfn, arg); > if (ret) >-- >2.21.0 -- Wei Yang Help you, Help me