From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B41F9ECE58F for ; Tue, 15 Oct 2019 11:42:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 815AB21848 for ; Tue, 15 Oct 2019 11:42:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 815AB21848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1B8A78E0005; Tue, 15 Oct 2019 07:42:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 168E78E0001; Tue, 15 Oct 2019 07:42:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 030638E0005; Tue, 15 Oct 2019 07:42:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id D5C218E0001 for ; Tue, 15 Oct 2019 07:42:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 64BBF2C37 for ; Tue, 15 Oct 2019 11:42:17 +0000 (UTC) X-FDA: 76045830714.22.cord70_6b2a9974ae53f X-HE-Tag: cord70_6b2a9974ae53f X-Filterd-Recvd-Size: 8136 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 11:42:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C88C110CC1F8; Tue, 15 Oct 2019 11:42:13 +0000 (UTC) Received: from [10.36.116.26] (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD4560127; Tue, 15 Oct 2019 11:42:04 +0000 (UTC) Subject: Re: [PATCH V6 1/2] mm/page_alloc: Make alloc_gigantic_page() available for general use To: Anshuman Khandual , linux-mm@kvack.org Cc: Andrew Morton , Vlastimil Babka , Greg Kroah-Hartman , Thomas Gleixner , Mike Rapoport , Mike Kravetz , Jason Gunthorpe , Dan Williams , Peter Zijlstra , Michal Hocko , Mark Rutland , Mark Brown , Steven Price , Ard Biesheuvel , Masahiro Yamada , Kees Cook , Tetsuo Handa , Matthew Wilcox , Sri Krishna chowdary , Dave Hansen , Russell King - ARM Linux , Michael Ellerman , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , "David S. Miller" , Vineet Gupta , James Hogan , Paul Burton , Ralf Baechle , "Kirill A . Shutemov" , Gerald Schaefer , Christophe Leroy , David Rientjes , Andrea Arcangeli , Oscar Salvador , Mel Gorman , linux-snps-arc@lists.infradead.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org References: <1571131302-32290-1-git-send-email-anshuman.khandual@arm.com> <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <9da1f196-51bd-06ac-c5dc-b55776fce2be@redhat.com> Date: Tue, 15 Oct 2019 13:42:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 15 Oct 2019 11:42:15 +0000 (UTC) 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: On 15.10.19 11:21, Anshuman Khandual wrote: > alloc_gigantic_page() implements an allocation method where it scans over > various zones looking for a large contiguous memory block which could not > have been allocated through the buddy allocator. A subsequent patch which > tests arch page table helpers needs such a method to allocate PUD_SIZE > sized memory block. In the future such methods might have other use cases > as well. So alloc_gigantic_page() has been split carving out actual memory > allocation method and made available via new alloc_gigantic_page_order() > which is wrapped under CONFIG_CONTIG_ALLOC. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Mike Kravetz > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: David Rientjes > Cc: Andrea Arcangeli > Cc: Oscar Salvador > Cc: Mel Gorman > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-mips@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-ia64@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s390@vger.kernel.org > Cc: linux-sh@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > include/linux/gfp.h | 3 ++ > mm/hugetlb.c | 76 +---------------------------------- > mm/page_alloc.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 102 insertions(+), 75 deletions(-) > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index fb07b503dc45..379ad23437d1 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -589,6 +589,9 @@ static inline bool pm_suspended_storage(void) > /* The below functions must be run on a range from a single zone. */ > extern int alloc_contig_range(unsigned long start, unsigned long end, > unsigned migratetype, gfp_t gfp_mask); > +extern struct page *alloc_gigantic_page_order(unsigned int order, > + gfp_t gfp_mask, int nid, > + nodemask_t *nodemask); > #endif > void free_contig_range(unsigned long pfn, unsigned int nr_pages); > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 977f9a323a7a..d199556a4a2c 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1023,86 +1023,12 @@ static void free_gigantic_page(struct page *page, unsigned int order) > } > > #ifdef CONFIG_CONTIG_ALLOC > -static int __alloc_gigantic_page(unsigned long start_pfn, > - unsigned long nr_pages, gfp_t gfp_mask) > -{ > - unsigned long end_pfn = start_pfn + nr_pages; > - return alloc_contig_range(start_pfn, end_pfn, MIGRATE_MOVABLE, > - gfp_mask); > -} > - > -static bool pfn_range_valid_gigantic(struct zone *z, > - unsigned long start_pfn, unsigned long nr_pages) > -{ > - unsigned long i, end_pfn = start_pfn + nr_pages; > - struct page *page; > - > - for (i = start_pfn; i < end_pfn; i++) { > - if (!pfn_valid(i)) > - return false; > - > - page = pfn_to_page(i); Am I missing something or should here really be a pfn_to_online_page() here instead of a pfn_valid() ? -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5299FC10F14 for ; Tue, 15 Oct 2019 11:44:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0605E21848 for ; Tue, 15 Oct 2019 11:44:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0605E21848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46strW69cvzDqlB for ; Tue, 15 Oct 2019 22:44:43 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46stnl1YdqzDqcY for ; Tue, 15 Oct 2019 22:42:19 +1100 (AEDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C88C110CC1F8; Tue, 15 Oct 2019 11:42:13 +0000 (UTC) Received: from [10.36.116.26] (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD4560127; Tue, 15 Oct 2019 11:42:04 +0000 (UTC) Subject: Re: [PATCH V6 1/2] mm/page_alloc: Make alloc_gigantic_page() available for general use To: Anshuman Khandual , linux-mm@kvack.org References: <1571131302-32290-1-git-send-email-anshuman.khandual@arm.com> <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <9da1f196-51bd-06ac-c5dc-b55776fce2be@redhat.com> Date: Tue, 15 Oct 2019 13:42:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 15 Oct 2019 11:42:15 +0000 (UTC) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , James Hogan , Heiko Carstens , Michal Hocko , Dave Hansen , Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , Andrea Arcangeli , linux-s390@vger.kernel.org, Jason Gunthorpe , x86@kernel.org, Russell King - ARM Linux , Matthew Wilcox , Steven Price , Tetsuo Handa , Gerald Schaefer , David Rientjes , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Kees Cook , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Mark Brown , "Kirill A . Shutemov" , Dan Williams , Vlastimil Babka , Oscar Salvador , Sri Krishna chowdary , Ard Biesheuvel , Greg Kroah-Hartman , linux-mips@vger.kernel.org, Ralf Baechle , linux-kernel@vger.kernel.org, Paul Burton , Mike Rapoport , Vineet Gupta , Martin Schwidefsky , Andrew Morton , Mel Gorman , "David S. Miller" , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 15.10.19 11:21, Anshuman Khandual wrote: > alloc_gigantic_page() implements an allocation method where it scans over > various zones looking for a large contiguous memory block which could not > have been allocated through the buddy allocator. A subsequent patch which > tests arch page table helpers needs such a method to allocate PUD_SIZE > sized memory block. In the future such methods might have other use cases > as well. So alloc_gigantic_page() has been split carving out actual memory > allocation method and made available via new alloc_gigantic_page_order() > which is wrapped under CONFIG_CONTIG_ALLOC. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Mike Kravetz > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: David Rientjes > Cc: Andrea Arcangeli > Cc: Oscar Salvador > Cc: Mel Gorman > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-mips@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-ia64@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s390@vger.kernel.org > Cc: linux-sh@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > include/linux/gfp.h | 3 ++ > mm/hugetlb.c | 76 +---------------------------------- > mm/page_alloc.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 102 insertions(+), 75 deletions(-) > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index fb07b503dc45..379ad23437d1 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -589,6 +589,9 @@ static inline bool pm_suspended_storage(void) > /* The below functions must be run on a range from a single zone. */ > extern int alloc_contig_range(unsigned long start, unsigned long end, > unsigned migratetype, gfp_t gfp_mask); > +extern struct page *alloc_gigantic_page_order(unsigned int order, > + gfp_t gfp_mask, int nid, > + nodemask_t *nodemask); > #endif > void free_contig_range(unsigned long pfn, unsigned int nr_pages); > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 977f9a323a7a..d199556a4a2c 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1023,86 +1023,12 @@ static void free_gigantic_page(struct page *page, unsigned int order) > } > > #ifdef CONFIG_CONTIG_ALLOC > -static int __alloc_gigantic_page(unsigned long start_pfn, > - unsigned long nr_pages, gfp_t gfp_mask) > -{ > - unsigned long end_pfn = start_pfn + nr_pages; > - return alloc_contig_range(start_pfn, end_pfn, MIGRATE_MOVABLE, > - gfp_mask); > -} > - > -static bool pfn_range_valid_gigantic(struct zone *z, > - unsigned long start_pfn, unsigned long nr_pages) > -{ > - unsigned long i, end_pfn = start_pfn + nr_pages; > - struct page *page; > - > - for (i = start_pfn; i < end_pfn; i++) { > - if (!pfn_valid(i)) > - return false; > - > - page = pfn_to_page(i); Am I missing something or should here really be a pfn_to_online_page() here instead of a pfn_valid() ? -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A6CAC10F14 for ; Tue, 15 Oct 2019 11:42:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBAAA21848 for ; Tue, 15 Oct 2019 11:42:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="szky4oWt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBAAA21848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PZ5fIg+5UIoSgpIR9Eza/sU7EWddi33PMtuRjci22jM=; b=szky4oWtALwoVfiVajIh5FVxW gMrblMow6S91zJsen/ivxdVcGeegTeFeZYyNuZajQ5l00/IYCZjb9+pGhwidi4YKtjSYimtSGqgHb 1RU30JAu8uMnFZVuYQJQzpPhyCHYltExxKO0nVlm1kkl2nF12M4KB3py268e/wuFJl6yaQ/XbTXIt bhAKx/XC9SfYSn9PE0JlXo56u+IELcAaahXLrNhmLB3IeMa8yM+CeHUtbTrOEh0yrZzItCY3xlGt0 RnXCHq3w7NB+bxAyTOuA/08Sj0NzLojID/WjfE8LlzZpKRfzw0ADNewAAKa7O3ShAeyXc0+30BSl0 BqVFDF+hQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKLDf-0000fJ-S8; Tue, 15 Oct 2019 11:42:27 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKLDU-0000WZ-Kj; Tue, 15 Oct 2019 11:42:18 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C88C110CC1F8; Tue, 15 Oct 2019 11:42:13 +0000 (UTC) Received: from [10.36.116.26] (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD4560127; Tue, 15 Oct 2019 11:42:04 +0000 (UTC) Subject: Re: [PATCH V6 1/2] mm/page_alloc: Make alloc_gigantic_page() available for general use To: Anshuman Khandual , linux-mm@kvack.org References: <1571131302-32290-1-git-send-email-anshuman.khandual@arm.com> <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <9da1f196-51bd-06ac-c5dc-b55776fce2be@redhat.com> Date: Tue, 15 Oct 2019 13:42:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 15 Oct 2019 11:42:15 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191015_044216_726012_151AAE53 X-CRM114-Status: GOOD ( 25.54 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , James Hogan , Heiko Carstens , Michal Hocko , Dave Hansen , Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , Andrea Arcangeli , linux-s390@vger.kernel.org, Jason Gunthorpe , Michael Ellerman , x86@kernel.org, Russell King - ARM Linux , Matthew Wilcox , Steven Price , Tetsuo Handa , Gerald Schaefer , David Rientjes , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Kees Cook , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Mark Brown , "Kirill A . Shutemov" , Dan Williams , Vlastimil Babka , Oscar Salvador , Christophe Leroy , Sri Krishna chowdary , Ard Biesheuvel , Greg Kroah-Hartman , linux-mips@vger.kernel.org, Ralf Baechle , linux-kernel@vger.kernel.org, Paul Burton , Mike Rapoport , Vineet Gupta , Martin Schwidefsky , Andrew Morton , Mel Gorman , "David S. Miller" , Mike Kravetz Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On 15.10.19 11:21, Anshuman Khandual wrote: > alloc_gigantic_page() implements an allocation method where it scans over > various zones looking for a large contiguous memory block which could not > have been allocated through the buddy allocator. A subsequent patch which > tests arch page table helpers needs such a method to allocate PUD_SIZE > sized memory block. In the future such methods might have other use cases > as well. So alloc_gigantic_page() has been split carving out actual memory > allocation method and made available via new alloc_gigantic_page_order() > which is wrapped under CONFIG_CONTIG_ALLOC. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Mike Kravetz > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: David Rientjes > Cc: Andrea Arcangeli > Cc: Oscar Salvador > Cc: Mel Gorman > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-mips@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-ia64@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s390@vger.kernel.org > Cc: linux-sh@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > include/linux/gfp.h | 3 ++ > mm/hugetlb.c | 76 +---------------------------------- > mm/page_alloc.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 102 insertions(+), 75 deletions(-) > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index fb07b503dc45..379ad23437d1 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -589,6 +589,9 @@ static inline bool pm_suspended_storage(void) > /* The below functions must be run on a range from a single zone. */ > extern int alloc_contig_range(unsigned long start, unsigned long end, > unsigned migratetype, gfp_t gfp_mask); > +extern struct page *alloc_gigantic_page_order(unsigned int order, > + gfp_t gfp_mask, int nid, > + nodemask_t *nodemask); > #endif > void free_contig_range(unsigned long pfn, unsigned int nr_pages); > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 977f9a323a7a..d199556a4a2c 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1023,86 +1023,12 @@ static void free_gigantic_page(struct page *page, unsigned int order) > } > > #ifdef CONFIG_CONTIG_ALLOC > -static int __alloc_gigantic_page(unsigned long start_pfn, > - unsigned long nr_pages, gfp_t gfp_mask) > -{ > - unsigned long end_pfn = start_pfn + nr_pages; > - return alloc_contig_range(start_pfn, end_pfn, MIGRATE_MOVABLE, > - gfp_mask); > -} > - > -static bool pfn_range_valid_gigantic(struct zone *z, > - unsigned long start_pfn, unsigned long nr_pages) > -{ > - unsigned long i, end_pfn = start_pfn + nr_pages; > - struct page *page; > - > - for (i = start_pfn; i < end_pfn; i++) { > - if (!pfn_valid(i)) > - return false; > - > - page = pfn_to_page(i); Am I missing something or should here really be a pfn_to_online_page() here instead of a pfn_valid() ? -- Thanks, David / dhildenb _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5BD8ECE588 for ; Tue, 15 Oct 2019 11:42:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 748C821848 for ; Tue, 15 Oct 2019 11:42:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ar8GYjQ8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 748C821848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fUuSLt9UgF1l0OucV5WhU6fMVpP3iTip2AlP7FqSZEI=; b=Ar8GYjQ8jZHcj4tJzzqfJVpY5 r6fo3fzLAwlIpr26kY7xgcDoI/e5dHMFD29ATQ1e+1OBEEqwYjuVYnFjz4bnylhOyOMLWp/mvfXbD DtyW4T3lBFHfrwZRrfU/1Kd2d7Yc7tqU9PEBemywsPIQDpbzqDspg6+HjUYaDtgDwjgaX2S2y2WOj YiMXpr5gwlgF0brFVqUuEP/tmRnSyoDprqqF09kRPMxqlZhRf4ZtrIhg+BUWNK6F54BrWn/fkV1pm 3D4jygUIg1a+95K45ILJUG52q+NW+cukb/E1GbBLCuB4TiiMVXnAhQgPpbG8yEsgK0NTO/UU5l7zD Gl4IhQEyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKLDY-0000Wx-Uh; Tue, 15 Oct 2019 11:42:20 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKLDU-0000WZ-Kj; Tue, 15 Oct 2019 11:42:18 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C88C110CC1F8; Tue, 15 Oct 2019 11:42:13 +0000 (UTC) Received: from [10.36.116.26] (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD4560127; Tue, 15 Oct 2019 11:42:04 +0000 (UTC) Subject: Re: [PATCH V6 1/2] mm/page_alloc: Make alloc_gigantic_page() available for general use To: Anshuman Khandual , linux-mm@kvack.org References: <1571131302-32290-1-git-send-email-anshuman.khandual@arm.com> <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <9da1f196-51bd-06ac-c5dc-b55776fce2be@redhat.com> Date: Tue, 15 Oct 2019 13:42:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <1571131302-32290-2-git-send-email-anshuman.khandual@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 15 Oct 2019 11:42:15 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191015_044216_726012_151AAE53 X-CRM114-Status: GOOD ( 25.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , James Hogan , Heiko Carstens , Michal Hocko , Dave Hansen , Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , Andrea Arcangeli , linux-s390@vger.kernel.org, Jason Gunthorpe , Michael Ellerman , x86@kernel.org, Russell King - ARM Linux , Matthew Wilcox , Steven Price , Tetsuo Handa , Gerald Schaefer , David Rientjes , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Kees Cook , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Mark Brown , "Kirill A . Shutemov" , Dan Williams , Vlastimil Babka , Oscar Salvador , Christophe Leroy , Sri Krishna chowdary , Ard Biesheuvel , Greg Kroah-Hartman , linux-mips@vger.kernel.org, Ralf Baechle , linux-kernel@vger.kernel.org, Paul Burton , Mike Rapoport , Vineet Gupta , Martin Schwidefsky , Andrew Morton , Mel Gorman , "David S. Miller" , Mike Kravetz Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 15.10.19 11:21, Anshuman Khandual wrote: > alloc_gigantic_page() implements an allocation method where it scans over > various zones looking for a large contiguous memory block which could not > have been allocated through the buddy allocator. A subsequent patch which > tests arch page table helpers needs such a method to allocate PUD_SIZE > sized memory block. In the future such methods might have other use cases > as well. So alloc_gigantic_page() has been split carving out actual memory > allocation method and made available via new alloc_gigantic_page_order() > which is wrapped under CONFIG_CONTIG_ALLOC. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Mike Kravetz > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: David Rientjes > Cc: Andrea Arcangeli > Cc: Oscar Salvador > Cc: Mel Gorman > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-mips@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-ia64@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s390@vger.kernel.org > Cc: linux-sh@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > include/linux/gfp.h | 3 ++ > mm/hugetlb.c | 76 +---------------------------------- > mm/page_alloc.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 102 insertions(+), 75 deletions(-) > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index fb07b503dc45..379ad23437d1 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -589,6 +589,9 @@ static inline bool pm_suspended_storage(void) > /* The below functions must be run on a range from a single zone. */ > extern int alloc_contig_range(unsigned long start, unsigned long end, > unsigned migratetype, gfp_t gfp_mask); > +extern struct page *alloc_gigantic_page_order(unsigned int order, > + gfp_t gfp_mask, int nid, > + nodemask_t *nodemask); > #endif > void free_contig_range(unsigned long pfn, unsigned int nr_pages); > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 977f9a323a7a..d199556a4a2c 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1023,86 +1023,12 @@ static void free_gigantic_page(struct page *page, unsigned int order) > } > > #ifdef CONFIG_CONTIG_ALLOC > -static int __alloc_gigantic_page(unsigned long start_pfn, > - unsigned long nr_pages, gfp_t gfp_mask) > -{ > - unsigned long end_pfn = start_pfn + nr_pages; > - return alloc_contig_range(start_pfn, end_pfn, MIGRATE_MOVABLE, > - gfp_mask); > -} > - > -static bool pfn_range_valid_gigantic(struct zone *z, > - unsigned long start_pfn, unsigned long nr_pages) > -{ > - unsigned long i, end_pfn = start_pfn + nr_pages; > - struct page *page; > - > - for (i = start_pfn; i < end_pfn; i++) { > - if (!pfn_valid(i)) > - return false; > - > - page = pfn_to_page(i); Am I missing something or should here really be a pfn_to_online_page() here instead of a pfn_valid() ? -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel