Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7367483yba; Thu, 2 May 2019 08:41:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1VuX34k2yUjZS0gvahLY0iyPY91Bj9l/xk8Vi7sDDWeKEuVaV9rkgK+MniXLZIdZwrz5x X-Received: by 2002:aa7:9116:: with SMTP id 22mr4891046pfh.165.1556811711685; Thu, 02 May 2019 08:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811711; cv=none; d=google.com; s=arc-20160816; b=xM8iU3YZE+Ji0DesnJHrjrJVCIFpDOsQ8uNWLYzOVzI9bR/FHi1Y/u2J9DwFGbp0IH XbFDGZhgtGxIDgRebASMgf+Bn2W4K6Gg4dQge9R5qEf3eVZs/8VpV9xZMqFwRZGdJj41 Nf8DFuU1LDf+tze0Yjj72r2P0LKEpdGJ+mVHGdTEvnZDE4S8gsbgWHRqvm9ddTq1XpxM j9RR90aV7eRyVl2HiRIU3TSbYclKk+DXyth+1NsSjG5uh5xkpn0xpVzvPEbKC7ZoU5wa tY8bmhLrO/KOPU6IbHoLTpTPOt/1uWznWDJF1U+V63Ug0/q5faOCKUzsmYY0+meXcbBW xItA== 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=/leJoppBbu58KfkuaC8uSH1NOeb3DKSZGT2KpEsXBa4=; b=XhjQp6BkGOtlaTBOB1AyR6LOsscLGSPljilFG49KK5ub3X08SP3bF0h6Xdhx1RELHV 7N6Ta8N37zD9bPBk3eQfQWGJ15o3yF79Ds3tLeh9qifeQB1Q13Pkrd6QzR4VyFqFeyJY ym1uXtGroB5A3AkYDS4lW9qG4cNiihAdqQZmopJ7b0YqeFzBZUC+BzWBzNjg+Q8RT3jF 7xI/IVG7X7swNXGZu+F4tCvX9RBPtG88kP190PcONzZ3tNHSeJ3zaOog5043emePWNsg ibtzLP+Lt+ah899r4WjfLAKwgh9qTuMAGMYsO1SNc4IGpXMpNG5tedeyabuqnalzgPyb 2DjQ== 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 l184si29014864pfl.43.2019.05.02.08.41.35; Thu, 02 May 2019 08:41: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; 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 S1728561AbfEBPix (ORCPT + 99 others); Thu, 2 May 2019 11:38:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56616 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728544AbfEBP3y (ORCPT ); Thu, 2 May 2019 11:29:54 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x42FT8o8007479 for ; Thu, 2 May 2019 11:29:53 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2s8235uc59-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 May 2019 11:29:53 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 May 2019 16:29:50 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) 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:29:41 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x42FTe3a53215466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 May 2019 15:29:40 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 617B852052; Thu, 2 May 2019 15:29:40 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.205.209]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id C91C15204F; Thu, 2 May 2019 15:29:35 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Thu, 02 May 2019 18:29:34 +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 09/15] nds32: switch to generic version of pte allocation Date: Thu, 2 May 2019 18:28:36 +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-0012-0000-0000-000003179C5E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19050215-0013-0000-0000-000021500C32 Message-Id: <1556810922-20248-10-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=999 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 nds32 implementation of pte_alloc_one_kernel() differs from the generic in the use of __GFP_RETRY_MAYFAIL flag, which is removed after the conversion. The nds32 version of pte_alloc_one() missed the call to pgtable_page_ctor() and also used __GFP_RETRY_MAYFAIL. Switching it to use generic __pte_alloc_one() for the PTE page allocation ensures that page table constructor is run and the user page tables are allocated with __GFP_ACCOUNT. The conversion to the generic version of pte_free_kernel() removes the NULL check for pte. The pte_free() version on nds32 is identical to the generic one and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/nds32/include/asm/pgalloc.h | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/arch/nds32/include/asm/pgalloc.h b/arch/nds32/include/asm/pgalloc.h index 3c5fee5..954696c 100644 --- a/arch/nds32/include/asm/pgalloc.h +++ b/arch/nds32/include/asm/pgalloc.h @@ -9,6 +9,9 @@ #include #include +#define __HAVE_ARCH_PTE_ALLOC_ONE +#include /* for pte_{alloc,free}_one */ + /* * Since we have only two-level page tables, these are trivial */ @@ -22,22 +25,11 @@ extern void pgd_free(struct mm_struct *mm, pgd_t * pgd); #define check_pgt_cache() do { } while (0) -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) -{ - pte_t *pte; - - pte = - (pte_t *) __get_free_page(GFP_KERNEL | __GFP_RETRY_MAYFAIL | - __GFP_ZERO); - - return pte; -} - static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { pgtable_t pte; - pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO, 0); + pte = __pte_alloc_one(mm, GFP_PGTABLE_USER); if (pte) cpu_dcache_wb_page((unsigned long)page_address(pte)); @@ -45,21 +37,6 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) } /* - * Free one PTE table. - */ -static inline void pte_free_kernel(struct mm_struct *mm, pte_t * pte) -{ - if (pte) { - free_page((unsigned long)pte); - } -} - -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) -{ - __free_page(pte); -} - -/* * Populate the pmdp entry with a pointer to the pte. This pmd is part * of the mm address space. * -- 2.7.4