From patchwork Sun Dec 9 15:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10720099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B4C71759 for ; Sun, 9 Dec 2018 15:01:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1A082A40D for ; Sun, 9 Dec 2018 15:00:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4A332A41F; Sun, 9 Dec 2018 15:00:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BE132A419 for ; Sun, 9 Dec 2018 15:00:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D859E8E005C; Sun, 9 Dec 2018 10:00:56 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CE25B8E005A; Sun, 9 Dec 2018 10:00:56 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B40088E005C; Sun, 9 Dec 2018 10:00:56 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 686EC8E005A for ; Sun, 9 Dec 2018 10:00:56 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id b17so7736495pfc.11 for ; Sun, 09 Dec 2018 07:00:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=0KMfyYLyN5o6yRvFEXtgLvdgGc2uMzx7ET/a+cXuAWQ=; b=QlfX5OMKqh0KalBSxHz6k0azTTyleSH6YPuIgdh5KilfhOHtumgrBFaCveibru3MnF tKkMq1E3uzS8JSQKRRUAr9r+aOJwm2Y3moVMwEBie4z9D1RTn8m+R01Zkww90qoEyQAr Iq7fOH8FE5n7PYt8ADxaw5yRndZnGipVIyc0+8e5pIvoyjCwgYWYkcvls8sbokMcQ7le ctou8OjdIoEOQwYg2DEu2orPSuH9XXLLMG/sNe9K76e70LeTm8kFyi1DjXGB4KydoIZJ JJlgM2vwJtOC2nxo7r2t/jAQmSsz4ywna9be4o+p89+GJo1uhbGkIGG0D5GzeMOurIG2 nvTQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AA+aEWaE7EaB7l2c69nk2kp2zFgYSHqck60Wz3zAGxQt0XV2W8TLmLBw 9fQ+HUXkX4YqWZRgY2ZJHaqNamzeHeGPN/a72PKopy8yS5yFO9V+fSjm8g8Kh82twi98W4khtx1 c6SfieM24G2caulvjMD28nZovXlM8m5LPyzECUq/if5kj31Uxo7j3UiBAL2sL9O98zg== X-Received: by 2002:a63:2bc4:: with SMTP id r187mr7858721pgr.306.1544367656016; Sun, 09 Dec 2018 07:00:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/W3hU2D7u5AUqfvGLVhDj/csQFnWWIY9ueO5xliruLKGlJpwR5E4zZ+duREp5DcpcToNUIA X-Received: by 2002:a63:2bc4:: with SMTP id r187mr7858682pgr.306.1544367655335; Sun, 09 Dec 2018 07:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544367655; cv=none; d=google.com; s=arc-20160816; b=QZgRpdMMAx3mxvoMaKeXn4gyHOeYMbLooDBr/D4S4soWVpkpfXVcUGDqxRSlmpLG7T w5Lbgx9c/o8pD8e+CFFPwqxZHzRp6JrFwtMcRN6AK8vtEiHntcsQIKui/5SwYlqf4F3v h/hJTwSKyDWT6lSuk+1XRE1XFRZ5TciFvL27jKy6bs9ijOz42D7Tp078LuMDRxPEoCv+ FePQXyDiRGqJ7rvgvij2uF4AzHvCj0DN/9y13aSWKBLi5tZ4+HcuFDmFhTnRcjGpTq+U UM4LlANn8VwqVyBfceCikKgO5dBSoOK+SF3HuDEqU0A48lchsXlGxSHXjnnMNRs4Rh+D bdmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=0KMfyYLyN5o6yRvFEXtgLvdgGc2uMzx7ET/a+cXuAWQ=; b=xR8SAAINmwK2pVojm9nQ0OkTAzL0RT43nrG7+ooo+mJ69YHYfU/wLzvmb8QB8CYCCx GSwhzzdMV2eBp2qTDNI33QHdtGWgAh6e+t4A5AYebnbcAvDZDuf3NppycENfUa8TyX56 uedIi8Pg5s6+6PYkBkRJRDcuVSAhmMWGfIO4sJGwDhMeuBTt+s2Z81tAUPguUUI0BPkw n0TpFCSIU0mBZmXEcU3QIptHxs5GiPigRjmvzLy9nZ9R/5oh9il349fWyJHXUcDHua30 +YMAfXjlnnL7crjmOG1SF9ab11/nTQ8cB7c5yb2YvWQi0kJdhTPCyEl9aEw2bdJ3FHxY kIkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id u8si8124181plh.385.2018.12.09.07.00.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Dec 2018 07:00:55 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB9ExIMD031525 for ; Sun, 9 Dec 2018 10:00:54 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p8v6u6s17-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 09 Dec 2018 10:00:54 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 9 Dec 2018 15:00:51 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 9 Dec 2018 15:00:44 -0000 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 wB9F0hlt3277258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 9 Dec 2018 15:00:43 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CE9AA405B; Sun, 9 Dec 2018 15:00:43 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FC15A404D; Sun, 9 Dec 2018 15:00:40 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.213]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 9 Dec 2018 15:00:40 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 09 Dec 2018 17:00:39 +0200 From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH v3 4/6] openrisc: simplify pte_alloc_one_kernel() Date: Sun, 9 Dec 2018 17:00:22 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544367624-15376-1-git-send-email-rppt@linux.ibm.com> References: <1544367624-15376-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18120915-0008-0000-0000-0000029EF7C7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120915-0009-0000-0000-00002209691D Message-Id: <1544367624-15376-5-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-09_05:,, 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=845 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812090139 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The pte_alloc_one_kernel() function allocates a page using __get_free_page(GFP_KERNEL) when mm initialization is complete and memblock_phys_alloc() on the earlier stages. The physical address of the page allocated with memblock_phys_alloc() is converted to the virtual address and in the both cases the allocated page is cleared using clear_page(). The code is simplified by replacing __get_free_page() with get_zeroed_page() and by replacing memblock_phys_alloc() with memblock_alloc(). Signed-off-by: Mike Rapoport Acked-by: Stafford Horne --- arch/openrisc/mm/ioremap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index c969752..cfef989 100644 --- a/arch/openrisc/mm/ioremap.c +++ b/arch/openrisc/mm/ioremap.c @@ -123,13 +123,10 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm, { pte_t *pte; - if (likely(mem_init_done)) { - pte = (pte_t *) __get_free_page(GFP_KERNEL); - } else { - pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - } + if (likely(mem_init_done)) + pte = (pte_t *)get_zeroed_page(GFP_KERNEL); + else + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); - if (pte) - clear_page(pte); return pte; }