Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp495888img; Thu, 21 Mar 2019 02:43:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3M83+SsLrC6aKMEY86onzY9xPGpamHLaqF5O6bQSlLhRNZC19tcynWJtTEKM/FwIVpoZj X-Received: by 2002:a17:902:142:: with SMTP id 60mr2557147plb.191.1553161422366; Thu, 21 Mar 2019 02:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553161422; cv=none; d=google.com; s=arc-20160816; b=NymCzZ8L1IRZdVZbfAIcfUzT8pWE8zuRyrTqA2DymYpmtAFwfvkNVRpzgLdw5Fbr+H /SzseDjKYOFWL6zU7qpJkEqJYO3z+zhDNBDPxqjQ1AoMi5Y1OcWl9XeEHAdIn+TDUu92 56lILf4k801z7mw2ECUh9cBK9g/FHHxolw2Zic1yzWRljN0J/Gj7oStYNsdYfvvWt0uL zVBoF4O5vYJAC1SVkhNea+5OlkLCwmNJ5bbMJJaYLK/JUb9BoG7IM2eCW/XAYA+aBitU q6CIo73MnvCUqZQjk6lBsHmHMgSspCs+8cpOplFdcM/qFky11/h69uGneOaO6VsUY7tl 49pA== 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:message-id:subject:cc :to:from:date; bh=ygxDCCfe8fc+VcNrxPZyO4/ItFDOXjtDmIcbVUjZXhU=; b=a+C1xO9Z4kah47zajAkE4/5C6mA3vvfKiev8dzW/oDimPG1CamWMOIOKP/EkEHyclz O3XJeUMZkQ/1R+7okeJLDwN+RNJNRxrhzcaz5pILZst4wos7UYyqhP5AHYEQEofnUZ7E xU4sWPbOOgzc5d/nUsGayICRrgsj5sx2RskpPi50WbQkezxBCFAkWZESKUw5a1ycsZi3 PzNZB5aLJk6j2GUWP+9A3cPGm2rUk6rDHbg90YjqB4nASv0sDiKCIbgXNvQIcdi8WQPl ydHoKO3sP0nt/e/KcTuWD1MuueYX9KpOC6xzqdyanzaGliDftPe41B4klEOzdWVnPiaB O7sA== 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 b3si3710535pgq.132.2019.03.21.02.43.26; Thu, 21 Mar 2019 02:43:42 -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; 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 S1728198AbfCUJmm (ORCPT + 99 others); Thu, 21 Mar 2019 05:42:42 -0400 Received: from charybdis-ext.suse.de ([195.135.221.2]:56694 "EHLO suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727946AbfCUJml (ORCPT ); Thu, 21 Mar 2019 05:42:41 -0400 Received: by suse.de (Postfix, from userid 1000) id 462B4464A; Thu, 21 Mar 2019 10:42:40 +0100 (CET) Date: Thu, 21 Mar 2019 10:42:40 +0100 From: Oscar Salvador To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, mike.kravetz@oracle.com, zi.yan@cs.rutgers.edu, mhocko@suse.com, akpm@linux-foundation.org Subject: Re: [PATCH] mm/isolation: Remove redundant pfn_valid_within() in __first_valid_page() Message-ID: <20190321094237.onu3kar2ez7xv5wj@d104.suse.de> References: <1553141595-26907-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1553141595-26907-1-git-send-email-anshuman.khandual@arm.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 21, 2019 at 09:43:15AM +0530, Anshuman Khandual wrote: > pfn_valid_within() calls pfn_valid() when CONFIG_HOLES_IN_ZONE making it > redundant for both definitions (w/wo CONFIG_MEMORY_HOTPLUG) of the helper > pfn_to_online_page() which either calls pfn_valid() or pfn_valid_within(). > pfn_valid_within() being 1 when !CONFIG_HOLES_IN_ZONE is irrelevant either > way. This does not change functionality. > > Fixes: 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages") > Signed-off-by: Anshuman Khandual About the "Fixes:" tag issue, I agree with Michal that the code is not really broken, but perhaps "suboptimal" depending on how much can affect performance on those systems where pfn_valid_within() is more complicated than simple returning true. I see that on arm64, that calls memblock_is_map_memory()->memblock_search(), to trigger a search for the region containing the address, so I guess it is an expensive operation. Depending on how much time we can shave, it might be worth to have the tag Fixes, but the removal of the code is fine anyway, so: Reviewed-by: Oscar Salvador > --- > mm/page_isolation.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index ce323e56b34d..d9b02bb13d60 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -150,8 +150,6 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages) > for (i = 0; i < nr_pages; i++) { > struct page *page; > > - if (!pfn_valid_within(pfn + i)) > - continue; > page = pfn_to_online_page(pfn + i); > if (!page) > continue; > -- > 2.20.1 > -- Oscar Salvador SUSE L3