Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2589240ybv; Sun, 9 Feb 2020 02:49:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyV2NnF61y7ffYb5wfMLqoJ6H5qTcUnLYMm5S0pGKbbL1bVeBVsPRMpv6oNOuZkUN9Xwnze X-Received: by 2002:a9d:7999:: with SMTP id h25mr6411311otm.347.1581245360395; Sun, 09 Feb 2020 02:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581245360; cv=none; d=google.com; s=arc-20160816; b=WFVDaWnHlGCJWGiE0Kb4ZoUYuxNIRjxSQ2oDFdBg6diVL3M6z4GWJpzSqpnx+FFFMu lXsFHau8BtWp6jFnEsebKHkKj54O1j8vrKQtL+NoXNTzVrY2p+oh4XyWduMwBott5r1R HuvhNHcmdA8Krc3t0BCbtl9amZ2IT6DvebyvItaJApAuO+WSoyFkhVO4Fzd88VuDt44z tBb+bIRt4v7bGIKQVs70faYHL7OWEbKa5BYPbSXd2N8N94MPcbtopzrbtgU4k5YnpBuN HWQeBEHsr3DXB6x9E998hNi2eLgZWPxk7fkcMhnXinqXES7WqXwV16XlBpVOyyu2XuWe T3YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cyQkz0IDAp8YMg8SL+7hb0Hu6kCeVjMVDG1Pwv2+n44=; b=giWfDuDAI2Hrf3dQy8tWI2+8DLkp/dSkAGPRkmHOzBYuh9GIrKA78xvi5zAQslXkw/ H0pVRnf9JirJDhqFu2uo9fYCsiHzkb6YlyxMktSp2L5G9AKB+sDk7fW25gfOlyn114+T qKuATCOVwepUHlFbmUZrbfjLzVScCBeLcS+trqzqS77O4Nbxgi0wOtdykSEsuztNmg9u aMPSXYD9dc9lLxkCXHzisAElLZvyXe345GglFRTv4nwkv4kkhZRwIopx7C/nWdhTEUJZ UrCVW1sC5ULsOyFZsML7+JukC8k+t3dF1vAJ+ITIoFVc9eiuH3RMSFPJXRxfbZW5oX2K iWGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ESovpFUo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si3087533otq.21.2020.02.09.02.49.09; Sun, 09 Feb 2020 02:49:20 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ESovpFUo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727754AbgBIKsv (ORCPT + 99 others); Sun, 9 Feb 2020 05:48:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:59249 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727716AbgBIKsu (ORCPT ); Sun, 9 Feb 2020 05:48:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581245329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=cyQkz0IDAp8YMg8SL+7hb0Hu6kCeVjMVDG1Pwv2+n44=; b=ESovpFUo8ThkEJzCFo9aEQ6kVfN3L9jBdRv2drbJx8dtkoPAjUam20d+3KGwByzf64oI5z DBRG+njqL+eLqk7ZxDezKmufhNdMDi0wO+FrRPryhP8zOl3tUAS6Ux6RLxCs7G2AR4yxAp ni/5bN3UPpRkCU7FNVc7Zg7CxFStMPs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-nuHf9OQHP6e8st3LnJLrKw-1; Sun, 09 Feb 2020 05:48:47 -0500 X-MC-Unique: nuHf9OQHP6e8st3LnJLrKw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE4A6107ACC4; Sun, 9 Feb 2020 10:48:45 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E54510013A7; Sun, 9 Feb 2020 10:48:42 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, dan.j.williams@intel.com, richardw.yang@linux.intel.com, david@redhat.com, bhe@redhat.com Subject: [PATCH 4/7] mm/sparse.c: Use __get_free_pages() instead in populate_section_memmap() Date: Sun, 9 Feb 2020 18:48:23 +0800 Message-Id: <20200209104826.3385-5-bhe@redhat.com> In-Reply-To: <20200209104826.3385-1-bhe@redhat.com> References: <20200209104826.3385-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This removes the unnecessary goto, and simplify codes. Signed-off-by: Baoquan He --- mm/sparse.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index cf55d272d0a9..36e6565ec67e 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -751,23 +751,19 @@ static void free_map_bootmem(struct page *memmap) struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap) { - struct page *page, *ret; + struct page *ret; unsigned long memmap_size = sizeof(struct page) * PAGES_PER_SECTION; - page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size)); - if (page) - goto got_map_page; + ret = (void*)__get_free_pages(GFP_KERNEL|__GFP_NOWARN, + get_order(memmap_size)); + if (ret) + return ret; ret = vmalloc(memmap_size); if (ret) - goto got_map_ptr; + return ret; return NULL; -got_map_page: - ret = (struct page *)pfn_to_kaddr(page_to_pfn(page)); -got_map_ptr: - - return ret; } static void depopulate_section_memmap(unsigned long pfn, unsigned long nr_pages, -- 2.17.2