Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp557136yba; Fri, 3 May 2019 06:51:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVIO/nm4trPi+fjr1MjR/4uMx7gp78EydwEENBrLybVPQu+6FxBBV6nDoiwzD+dbLVK81C X-Received: by 2002:a17:902:1c1:: with SMTP id b59mr10594580plb.182.1556891506503; Fri, 03 May 2019 06:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556891506; cv=none; d=google.com; s=arc-20160816; b=TeX1schF+rxSZY8k4ot4XjXEOrtx0qoIZErTmUmf/PcpEYO6FZT9PMmgTQFFs1O3JQ JWX+NonpgbnteTpUm9uFJGqlTugX+CuVp3PbPo2uYdkHFK3BQxQepuWTYEmVeweni0mh X+RaUcZ1B5jPxYdv7vbBoekuBz/j8Wrp0FK08lTSU+sNv5gQGn191pcab/i5nwFqb+pt ZnDO6txItcvkepbsa8nbjUBtxETeUU7snZIFbJ15dNNuqC4fgdhXdJrXlbdZt2hq9Rg+ quvsByqfoubV+TEK5TxJHt5bVSLR4N/M09tfTm/q3cHYmSOSLEUFqr37UQI5GRwOGAvZ ds5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Z/KtDnWExF4yyZOJzhA9L38T7S9JPisDEL16/gNwQ68=; b=cseCmhMoNMlXiXNwHg9bvLly2gtcSwNpeWtc0yOJ7ohp7g1CpWfVhvlv15WmLpyGbI YZb1nRGNNoR+WBoseFBOxlViBPHpjl01W3KXUwBWAtuMVkQWbH2YWumT7Zp0EA+3/HG+ vY0qVTvGodA1V+fcVhN9rd7LKcYZAzvj2v8bj0WfUzjS0MGv5wjCDkLBZ2Jkt9prf6fz nK9IfUGsSd1/Wd/l1rIsYWoydzcg4FAU4dvV6ASIPRcvIUaA8QspRcme8JbnVfrmOsp8 OAXiIJcoD8EfcGLsuxWYHiE1K2LcIncmwhTvaDA1SW2VIviGrC2+og5WHyqNw15/OE6H u/vQ== 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 f23si2214990pfn.136.2019.05.03.06.51.30; Fri, 03 May 2019 06:51:46 -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 S1727726AbfECN3i (ORCPT + 99 others); Fri, 3 May 2019 09:29:38 -0400 Received: from ivanoab6.miniserver.com ([5.153.251.140]:48050 "EHLO www.kot-begemot.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbfECN3g (ORCPT ); Fri, 3 May 2019 09:29:36 -0400 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 Cc: Michal Hocko , Catalin Marinas , Palmer Dabbelt , linux-mips@vger.kernel.org, Guo Ren , linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, Michael Ellerman , Helge Deller , x86@kernel.org, Russell King , Matthew Wilcox , Geert Uytterhoeven , Matt Turner , Sam Creasey , Arnd Bergmann , linux-um@lists.infradead.org, Richard Weinberger , linux-m68k@lists.linux-m68k.org, Greentime Hu , nios2-dev@lists.rocketboards.org, Guan Xuetao , linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Kuo , Paul Burton , linux-alpha@vger.kernel.org, Ley Foon Tan , linuxppc-dev@lists.ozlabs.org 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-Spam-Score: -1.0 X-Spam-Score: -1.0 X-Clacks-Overhead: GNU Terry Pratchett Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/