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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS 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 CC9E2C04AAA for ; Fri, 3 May 2019 22:31:13 +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 426A7206C1 for ; Fri, 3 May 2019 22:31:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 426A7206C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44wn0Z0ZvJzDqZb for ; Sat, 4 May 2019 08:31:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=cambridgegreys.com (client-ip=5.153.251.140; helo=www.kot-begemot.co.uk; envelope-from=anton.ivanov@cambridgegreys.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Received: from www.kot-begemot.co.uk (ivanoab6.miniserver.com [5.153.251.140]) (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 44whLZ1p9szDqVc for ; Sat, 4 May 2019 05:01:23 +1000 (AEST) Received: from [192.168.17.6] (helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hMYFM-00074d-Bk; Fri, 03 May 2019 13:29:04 +0000 Received: from jain.kot-begemot.co.uk ([192.168.3.3]) by jain.kot-begemot.co.uk with esmtp (Exim 4.89) (envelope-from ) id 1hMYFF-0001a5-CV; Fri, 03 May 2019 14:29:03 +0100 Subject: Re: [PATCH 14/15] um: switch to generic version of pte allocation To: Mike Rapoport , Andrew Morton References: <1556810922-20248-1-git-send-email-rppt@linux.ibm.com> <1556810922-20248-15-git-send-email-rppt@linux.ibm.com> From: Anton Ivanov Message-ID: <3fddc076-1843-ee84-febb-44c8d317489f@cambridgegreys.com> Date: Fri, 3 May 2019 14:28:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1556810922-20248-15-git-send-email-rppt@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Clacks-Overhead: GNU Terry Pratchett X-Mailman-Approved-At: Sat, 04 May 2019 08:29:08 +1000 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: Michal Hocko , Catalin Marinas , Palmer Dabbelt , linux-kernel@vger.kernel.org, Guo Ren , linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, Richard Weinberger , Helge Deller , x86@kernel.org, Russell King , Matthew Wilcox , Geert Uytterhoeven , Matt Turner , Sam Creasey , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, Greentime Hu , Ley Foon Tan , Guan Xuetao , linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-mips@vger.kernel.org, Richard Kuo , Paul Burton , nios2-dev@lists.rocketboards.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 02/05/2019 16:28, Mike Rapoport wrote: > um allocates PTE pages with __get_free_page() and uses > GFP_KERNEL | __GFP_ZERO for the allocations. > > Switch it to the generic version that does exactly the same thing for the > kernel page tables and adds __GFP_ACCOUNT for the user PTEs. > > The pte_free() and pte_free_kernel() versions are identical to the generic > ones and can be simply dropped. > > Signed-off-by: Mike Rapoport > --- > arch/um/include/asm/pgalloc.h | 16 ++-------------- > arch/um/kernel/mem.c | 22 ---------------------- > 2 files changed, 2 insertions(+), 36 deletions(-) > > diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h > index 99eb568..d7b282e 100644 > --- a/arch/um/include/asm/pgalloc.h > +++ b/arch/um/include/asm/pgalloc.h > @@ -10,6 +10,8 @@ > > #include > > +#include /* for pte_{alloc,free}_one */ > + > #define pmd_populate_kernel(mm, pmd, pte) \ > set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) > > @@ -25,20 +27,6 @@ > extern pgd_t *pgd_alloc(struct mm_struct *); > extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); > > -extern pte_t *pte_alloc_one_kernel(struct mm_struct *); > -extern pgtable_t pte_alloc_one(struct mm_struct *); > - > -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) > -{ > - free_page((unsigned long) pte); > -} > - > -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) > -{ > - pgtable_page_dtor(pte); > - __free_page(pte); > -} > - > #define __pte_free_tlb(tlb,pte, address) \ > do { \ > pgtable_page_dtor(pte); \ > diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c > index 99aa11b..2280374 100644 > --- a/arch/um/kernel/mem.c > +++ b/arch/um/kernel/mem.c > @@ -215,28 +215,6 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd) > free_page((unsigned long) pgd); > } > > -pte_t *pte_alloc_one_kernel(struct mm_struct *mm) > -{ > - pte_t *pte; > - > - pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); > - return pte; > -} > - > -pgtable_t pte_alloc_one(struct mm_struct *mm) > -{ > - struct page *pte; > - > - pte = alloc_page(GFP_KERNEL|__GFP_ZERO); > - if (!pte) > - return NULL; > - if (!pgtable_page_ctor(pte)) { > - __free_page(pte); > - return NULL; > - } > - return pte; > -} > - > #ifdef CONFIG_3_LEVEL_PGTABLES > pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) > { > Reviewed-by: Anton Ivanov Acked-by: Anton Ivanov -- Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/