Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4961862imu; Sun, 25 Nov 2018 13:46:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/XAjDAq/VZJFVlcTQP1kCf67r60Mf+8h1wZSAIwqrUmbW1kX9E9HLCUcGP6UgKZP9NjmMAl X-Received: by 2002:a17:902:1122:: with SMTP id d31-v6mr25018363pla.259.1543182367570; Sun, 25 Nov 2018 13:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182367; cv=none; d=google.com; s=arc-20160816; b=nGmW8jZQ34YmKqdRWtRX+p1H+ryy7EbkPLY7SLEcGmPYCtXgCGERDpRGtUWhxPWoBD u0MobhHdbv/K2ZkvPTkJo2A8u/fFFAwujhfeYRNdAekg6MtVnIdEKJGVMsxfu9HoIojs RayrYJ5A495u+9bG4/3uRlGkKyz7thmjTA4+k5c1YnbSku3r56+QIUtmf7RHz5M3MU8R HAOOTIAA17t3PB57Qk7MQnDXGIQPC+XBx9F1/Q0GMLv0n8oMstxK0zJLUZ1L/Tyh2QPq xyPqg/zXbfLEqtthz2Q28pSrPkmnQjkBUX8VtL2uWWqSOhUBZtOEZFeoFwEH7a1GpFKz Gz7Q== 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=xMd4cYPweqc3nWr4Hf1Sat0/69ZwJ360J04Rwzyh4CA=; b=r2fHoX9B6gey8fuerzhc8jUIhYqisNkSIz0Y9p3rNOEy6bq87RlB38nGAS2bYNHE4j dyYS7lehSlLgS2hjpHkA+mj0+JQxvw/+Ev9QWkwohXuxlBf+GzDoWx4u2+2y4IzT6Cb8 PxAk170wHjML0CNDGymWUGkfci0JEHhQlw6AIev5QpxAhNRLJPzkyHarR9I9/654Nn7o bZsuG0lZLBnWg3R35+Sg86gHMvPWgFqz7onh6FIkamPNk3h58CyZKot+F/RP7PnDIJ9p axi+oSgGOi8nnE5v7puO/ARbszM3fk8z7OGGeE7qrObt7X313YRQroD2F8aGAJ/Dc1vH oZ1A== 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 b12si44822644plx.159.2018.11.25.13.45.52; Sun, 25 Nov 2018 13:46:07 -0800 (PST) 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 S1726280AbeKZIhO (ORCPT + 99 others); Mon, 26 Nov 2018 03:37:14 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36474 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726167AbeKZIhN (ORCPT ); Mon, 26 Nov 2018 03:37:13 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAPLi61K091916 for ; Sun, 25 Nov 2018 16:45:09 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nymsk73kj-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=743 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; } -- 2.7.4