From patchwork Sun Nov 25 21:44:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697125 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 D13201591 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C297829A14 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6B3129A6C; Sun, 25 Nov 2018 21:45:13 +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=ham 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 467D429A14 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5F336B3E45; Sun, 25 Nov 2018 16:45:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BE9216B3E46; Sun, 25 Nov 2018 16:45:11 -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 A3F1B6B3E47; Sun, 25 Nov 2018 16:45:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 5427F6B3E45 for ; Sun, 25 Nov 2018 16:45:11 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id e89so9711820pfb.17 for ; Sun, 25 Nov 2018 13:45:11 -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=xMd4cYPweqc3nWr4Hf1Sat0/69ZwJ360J04Rwzyh4CA=; b=K8zwoHeFseMvbCSz35Bdt78YJG8SGT+IJPAnx5j+AVSIWY46J42fKmBoEkGU31TOPa CXNzIj4o4ddn6dcDpUsjYkEKYE3Ka/NtKsmWjEZzQMVLyL11T0sMeTILWsQW+1mz5eX8 Y3nUYI9rDT1kbiMLq5b9byY9hjhpJ66i8cZ257YnCMiDwhaUhJnDuNF3s57HlsjZwiQE WuNN/ai1OSDyDWRR587fC9lVSwTBIHbBN3AUTyeUz2mbJhVmsRlttacMhddmIa7W4z0X r0Na/BozRmdYaiUnEeIAxyIXdBE+NdBueeva8XMCJFHj1feiVjJ8sFZadfGLqzK2cqo2 9YcQ== 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+aEWasPyeLYDZSHOy6Q/JtuJmYBR9GK3OB2oOVh2/8EZC+fPc5lOVR 7NzqDbp1js4aHu+RK54pr16O67kvUFLdwteJSwdC9dDbzzbNlUUrCwyV+Mp77ClnNpFQzs6wWIC xQ+h6MUW4Jp/Vw7ccAoAvWbZf7oCJwZ8OpxBxvYSTH5xIyoE/5C19IEiMY+b7fv54Gg== X-Received: by 2002:a17:902:e18c:: with SMTP id cd12mr8786662plb.279.1543182311019; Sun, 25 Nov 2018 13:45:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8y6KCFMRXabIVf+hCK1trY86xOgOviKUKqPdXnk0yt3P4wv6N0+ptCi3Eg9lefZ+MdLgl X-Received: by 2002:a17:902:e18c:: with SMTP id cd12mr8786637plb.279.1543182310454; Sun, 25 Nov 2018 13:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182310; cv=none; d=google.com; s=arc-20160816; b=YujGoWGVBMNT2FhLAQ0QgCAIJSLqFqZv2YwaHoZLtvNkFAcH/BbQpQsq3zY7DaoghG 1XIoKc3OH2k2bN84vona0Wtrw9cG76H4R9AZivaj7xaXSgyXe7JPSC8NP1Z6ir7MTGg/ ZugoKLHfK6cMLrQFI3RmvUNW/0g91QViQYumObctCgHz1zh1R7OSSgd+/+FhRbEYxaXJ 1I8rzkAiIDLX5rt2GwQMQFpOUUsi8EdZ5Dkt94CjhDpA2kzkmfUZfL8rt5joOjLXmms7 Aci/uoGFo38NLYk0xblUNtMmQ7oqTqD2gEYTpRVQWuFCJ7aCCkAIfuhAGuxdJNmWWJuk 82HQ== 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=xMd4cYPweqc3nWr4Hf1Sat0/69ZwJ360J04Rwzyh4CA=; b=B+czEC4gdiBKfXhEIWXbtWWOlb8t669+Ul41mSEHB9c81Gpk/3V8TLjgPtCfSC1Jca XrIWwmD5J01cdzh/m1AJocKr/ZvgQeLebpLTsKLq+LqCF1dDq+f/fZzqWj/Gv3Vf8+a3 gnedXEG2vgrRNNxO6H/thEPH4622K32F0L+Kkz9rGZrRYNAyWsZG0TG6OSclISXUcVJC mHPsScaXEu9UFMpZDlc8NlUqORfC1u14PFSdyvdkVCWf9rEBny+8JpQ2gQydNZrBwPmE ixsfgS6LAOu+PmDMpxCS5U8RRJeo5Yh78qFInsFpjAeZTFbQVwsqqZl9pwNaJKMXn8jO LRJA== 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 q14si59863190pgg.433.2018.11.25.13.45.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:45:10 -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 wAPLifcY013702 for ; Sun, 25 Nov 2018 16:45:10 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nymvtptpp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:45:09 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:45:07 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Sun, 25 Nov 2018 21:45:00 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLixJQ61800506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:44:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 312B94C044; Sun, 25 Nov 2018 21:44:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E78044C046; Sun, 25 Nov 2018 21:44:55 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 25 Nov 2018 21:44:55 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:55 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , 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-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 4/5] openrisc: simplify pte_alloc_one_kernel() Date: Sun, 25 Nov 2018 23:44:36 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-0016-0000-0000-0000022C7BAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-0017-0000-0000-00003284CC10 Message-Id: <1543182277-8819-5-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=741 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 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; }