Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7364754yba; Thu, 2 May 2019 08:39:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWwQdE6r1c5GjvwvBWp8t8AvXqyhOJDxiqxULPIYK3ngQYyqi/yDETgBD4SIDOulE/gbcf X-Received: by 2002:a17:902:e086:: with SMTP id cb6mr4489298plb.237.1556811568448; Thu, 02 May 2019 08:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811568; cv=none; d=google.com; s=arc-20160816; b=sa8dEWno1LfBr+oiiNQpYhHVGqBkK/6A9XgM+bH6UWo4QBuLoyYd5lXNjOq2iySKnb lldWVt7efcoyc74mOBkY4mJbaldEBgHGsaiIxzxrxKSKIWDRfvarr1vsaS+7BQGOATbI mpubI3IQtLmwtnvQ1uP7+Cr1lJJczI+Obf3i3ailsJp4HWcnsKrHxKrLuLs4vPr6Ck0b Jmro/Gjo1HANXeGE/qoPyme7Q+Gkq0bRwfhI0XkcEe1hsRmP91GpkBLgzm0XV2kSZXef 2/tN4pNMpPMsG6zCqUHyw97ZozldLMx9IH5EEj0zvuBFKh4c01rvB6hCHeVCjrF5H5Z5 RgFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=Nn4KeO5UsPqY/PJ04NJcSRnV339GhUTNcJe66uLPxIQ=; b=IuCWlfmmB7x7+rEb/U8clcp0+C3keygxAw3GjztBBtjDba1x7gDHjbEuzf8h2i5uo/ kpIx3w/9Tiv7mD1vOWvL5P2FTts3cuX5c1TL9d5LVpsCqFQ6Ow6YamCqTY9LBhn31LPE LIGoDJlYt4tIq579LWaUUam5iv3ThfgJT/4x91g6uk+ZhqB3SLsJfQdz0hkDYEJUh9Ey gNLIJRMq98HSnpYJiwmu7I9H8XJY9sjfBvS4xq0LrT9YoQD/LHh7CCkcq+DHySoYGCIq zwl0+XM/1jAg0M/O+Z3hQjf2jdrqQ+0z6sdq8SKxiBuPMIvhy8bo53DvpaQFAKCRELpu ObLw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si47536831pll.324.2019.05.02.08.39.12; Thu, 02 May 2019 08:39:28 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728706AbfEBPaS (ORCPT + 99 others); Thu, 2 May 2019 11:30:18 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60952 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728674AbfEBPaQ (ORCPT ); Thu, 2 May 2019 11:30:16 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x42FS3xN120997 for ; Thu, 2 May 2019 11:30:14 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2s824xbdbm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 May 2019 11:30:14 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 May 2019 16:30:12 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 2 May 2019 16:30:04 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x42FU3Rx47448134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 May 2019 15:30:03 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3ED79A4051; Thu, 2 May 2019 15:30:03 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B33DCA4057; Thu, 2 May 2019 15:29:58 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.205.209]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 2 May 2019 15:29:58 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Thu, 02 May 2019 18:29:57 +0300 From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Catalin Marinas , Geert Uytterhoeven , Greentime Hu , Guan Xuetao , Guo Ren , Helge Deller , Ley Foon Tan , Matthew Wilcox , Matt Turner , Michael Ellerman , Michal Hocko , Palmer Dabbelt , Paul Burton , Richard Kuo , Richard Weinberger , Russell King , Sam Creasey , 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, Mike Rapoport Subject: [PATCH 13/15] riscv: switch to generic version of pte allocation Date: Thu, 2 May 2019 18:28:40 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556810922-20248-1-git-send-email-rppt@linux.ibm.com> References: <1556810922-20248-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19050215-0016-0000-0000-00000277A12E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19050215-0017-0000-0000-000032D4363D Message-Id: <1556810922-20248-14-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-02_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=975 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905020103 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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); \ -- 2.7.4