Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2784836yba; Mon, 6 May 2019 11:28:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzECe0JdjiFl2gqlWb+hM26dLBT3BcvF5HHS8P+x9fTeopgXZJ+MyZFS9LHGaq4A6mASvxt X-Received: by 2002:a17:902:b210:: with SMTP id t16mr34118148plr.84.1557167332000; Mon, 06 May 2019 11:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557167331; cv=none; d=google.com; s=arc-20160816; b=NGXx9a5PeD8q/Iy1RnVe5Yq3PEbCiwb1s8tJqQRBXjwpYi2UsPqoDFuctFX/TZ13v+ oEl/zDYLC1Vc3M09fucCkhtpJYWuZNfP/vpi/slbROafD9J+8gUEatC1oe36PWPxYZys QbUcVUWJFy0LounybacqbCzkHMHFC2L1yTJ/5U524O7iBJVXgznJ1EQJJXc21ZZMIKao t/wpg+xLSf0co1VW1C7Re5l28GqyjxZtoyUh6QCU5GsIGyE0aKF3S0BqVQPHwkbO+VYj jnfR+pzKAZTVJrlMJq/cDdk9F0YRMWD1A5iEBgv7KiqY6pNgqlPmD/mG5yADsROVOvPZ OdPw== 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:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=NXCCd9DEwpVv+CkVk+97oddxbHXiAPPbrF6iGBSrYgc=; b=m0JP5CyjDIYL+/rqFFipXIraHLYGBi4COZGOe5TyUYWDXR37SvYdd/En7fCFCx4NQ4 qmtrLZBOJ6601w7hFkJgyJQLoMVtOJqcaK0vj/qd/97DYig1w4VEW20ahJWnEWm9/vwI OPYA3D9u0yvUFhqhlqFMF/RUqnrHaVSHGS9qlDZXPq960sQBAPbhkRyo0sbL1qLtpEoC X/+wnR0zr/6HALJorDY3JWDsRkbtU8vpHRhpDdZ9nHTBbGR9ujG9qSC0/IEaxbMjYb0z ZxZMRSKFjzdi1zFcT5RlhIhAH5242QNNw8KSMKTZh8AUEVYdxu9OPOnfXanNwvWqPt/i fWaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=NKrWKCiG; 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 d31si16965248pla.89.2019.05.06.11.28.32; Mon, 06 May 2019 11:28:51 -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=@sifive.com header.s=google header.b=NKrWKCiG; 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 S1726515AbfEFSZz (ORCPT + 99 others); Mon, 6 May 2019 14:25:55 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45005 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbfEFSZy (ORCPT ); Mon, 6 May 2019 14:25:54 -0400 Received: by mail-pf1-f194.google.com with SMTP id y13so7197270pfm.11 for ; Mon, 06 May 2019 11:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=NXCCd9DEwpVv+CkVk+97oddxbHXiAPPbrF6iGBSrYgc=; b=NKrWKCiGbzmza35fOtOMvL+ftXETfh3uUcp/GkaCXcI8/XzVP8qVDBZioaj7yzgwas 2tQRRTKTuRAtOwQhT+kcUBv2qp2jRZVnznAovTkgFRvmAuuaShMFB+Nx1bbVUNa9A7OX 8BLulEh57QbYge20tVCIr34v+fwMGVGOSH1ehzMLel+zcPUV1nVeQpw7cWLe4F7TLSOw ++VBDFOhS3lKU6/bS8dLLIX6A8ANpsIH1DryjqnbCnoWXwVNSYR3C7RBe/CPhV/P7ncT Cg2Mr2IcrlFerHMT/L21aU76jEgkMtiGDQAE6F2Y4uyRJKfpkAmDpf2MCdenO33CvIPF KysQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=NXCCd9DEwpVv+CkVk+97oddxbHXiAPPbrF6iGBSrYgc=; b=l4XkZDYYLg1zHbR7lpP6FjR5CV6+k3bXPo3wkBTw1TgvEW88JWRB+EDyEfVdA+m8dM Bs+qlChlTa3ced4jkcDMIRSy/HTSmGTWBxaSSI9XK0V6lv6F6/+bXDu7mmAhnK7h6G+m cIuGz96vmZPSh7nSgvIk7lbw+kAQ4ysYVGgH5CHZOVLnewI0sMEz9TKZjXlTKs3SHCPK /TEBsVGUibjgE+QSjwga5ywo9Xn7dj+4h33H9OHoAp1HskouC13gWqmZu/mpWikpbDtO ElJCnk/ROyEOT7dchjCLPxZ5v8c6sFN853gBRdiYrsX41kRE5ZzwMkTAgyIEVA/omIsr OnPg== X-Gm-Message-State: APjAAAVT5q3o1StjKZ21rLOKg/Xo6Qfyd83FtuFyXvtoAaFLoo9sjKxu c8ipr3Bo/R2YTRW/bgtKRGF58g== X-Received: by 2002:a62:121c:: with SMTP id a28mr34935323pfj.58.1557167153191; Mon, 06 May 2019 11:25:53 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id x66sm15776570pfb.78.2019.05.06.11.25.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2019 11:25:52 -0700 (PDT) Date: Mon, 06 May 2019 11:25:52 -0700 (PDT) X-Google-Original-Date: Mon, 06 May 2019 11:25:42 PDT (-0700) Subject: Re: [PATCH 13/15] riscv: switch to generic version of pte allocation In-Reply-To: <1556810922-20248-14-git-send-email-rppt@linux.ibm.com> CC: akpm@linux-foundation.org, Arnd Bergmann , catalin.marinas@arm.com, geert@linux-m68k.org, green.hu@gmail.com, gxt@pku.edu.cn, guoren@kernel.org, deller@gmx.de, lftan@altera.com, willy@infradead.org, mattst88@gmail.com, mpe@ellerman.id.au, mhocko@suse.com, paul.burton@mips.com, rkuo@codeaurora.org, richard@nod.at, linux@armlinux.org.uk, sammy@sammy.net, x86@kernel.org, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-um@lists.infradead.org, nios2-dev@lists.rocketboards.org, rppt@linux.ibm.com From: Palmer Dabbelt To: rppt@linux.ibm.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 02 May 2019 08:28:40 PDT (-0700), rppt@linux.ibm.com wrote: > The only difference between the generic and RISC-V implementation of PTE > allocation is the usage of __GFP_RETRY_MAYFAIL for both kernel and user > PTEs and the absence of __GFP_ACCOUNT for the user PTEs. > > The conversion to the generic version removes the __GFP_RETRY_MAYFAIL and > ensures that GFP_ACCOUNT is used for the user PTE allocations. Reviewed-by: Palmer Dabbelt I'm assuming this is going in along with the rest of the patches, so I'm not going to add it to my tree. > > 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/riscv/include/asm/pgalloc.h | 29 ++--------------------------- > 1 file changed, 2 insertions(+), 27 deletions(-) > > diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h > index 94043cf..48f28bb 100644 > --- a/arch/riscv/include/asm/pgalloc.h > +++ b/arch/riscv/include/asm/pgalloc.h > @@ -18,6 +18,8 @@ > #include > #include > > +#include /* for pte_{alloc,free}_one */ > + > static inline void pmd_populate_kernel(struct mm_struct *mm, > pmd_t *pmd, pte_t *pte) > { > @@ -82,33 +84,6 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) > > #endif /* __PAGETABLE_PMD_FOLDED */ > > -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) > -{ > - return (pte_t *)__get_free_page( > - GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO); > -} > - > -static inline struct page *pte_alloc_one(struct mm_struct *mm) > -{ > - struct page *pte; > - > - pte = alloc_page(GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO); > - if (likely(pte != NULL)) > - pgtable_page_ctor(pte); > - return pte; > -} > - > -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, buf) \ > do { \ > pgtable_page_dtor(pte); \