From patchwork Wed Mar 20 07:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 10860951 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 00C1D13B5 for ; Wed, 20 Mar 2019 07:35:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDDC729A38 for ; Wed, 20 Mar 2019 07:35:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C16F429A43; Wed, 20 Mar 2019 07:35:58 +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 337DA29A38 for ; Wed, 20 Mar 2019 07:35:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8CD06B0003; Wed, 20 Mar 2019 03:35:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B3C7A6B0006; Wed, 20 Mar 2019 03:35:56 -0400 (EDT) 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 A2A526B0007; Wed, 20 Mar 2019 03:35:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id 888D16B0003 for ; Wed, 20 Mar 2019 03:35:56 -0400 (EDT) Received: by mail-qk1-f200.google.com with SMTP id y64so12390583qka.3 for ; Wed, 20 Mar 2019 00:35:56 -0700 (PDT) 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:message-id; bh=tuB9PNNGBdrtgxjPzbnq4e1RMAH2qhJJfR1+/49znvY=; b=M/u0GM0gbAntpgadqaY9fa+nDAgkCphpAzk/wp3ZSmTfSw8mlDwWrxcWsK/9zhyTTx 9huhufV4VEgV/omL343FWUSTFVKzwv2GiDKwUdVWEXPSUqAZmnHfh2aCU8qen5nY6rEB UDaxV41DI+lm/0/a2CxYX/Y6KnqkaCYzW1DjLGyHJpbaPz984UhO3i2/hf8EHNyKLT7K TqX+aVDvSiIO1xxDegFjrZtNLROP2Orj95nYEjLnuMCraaIEFl/qwenQBllVlwyar6Px LpJMclbNW12pXhcDH28jnrmfk1UpJb0ZRHh/U6qNi+XFKCE+x1fgesUdZygtOSnJVT2i T/TA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAW5xuDstOTJGuzJ1JYui70/V3BTmWcaAnEs6fLrjbEwsx4GFBCb qqVQe2LipddxDjPZsVLzPqxSizjHxgPjPWO7e5HrGMrzR3/SMGh6iWNsc9IUKrw5zDXpICa9QU1 bwDU1fQhrRonZ/w1ogiEpP2cYsFzmI9/o69ox9jH4bMe81qwRYWo6Ezz3QganA8xZvg== X-Received: by 2002:ac8:2f6f:: with SMTP id k44mr5539313qta.230.1553067356238; Wed, 20 Mar 2019 00:35:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhtDhr/7Yk1HoLYUhVjM3pjonHo5MqO1ixvJNReGM7ebpyM+gmbdKcpod+IRnLeWLz6rDg X-Received: by 2002:ac8:2f6f:: with SMTP id k44mr5539274qta.230.1553067355232; Wed, 20 Mar 2019 00:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553067355; cv=none; d=google.com; s=arc-20160816; b=F0uNXbtZIZ4nymhlF9WJX9Zpf0yXrO2zl36o0dpyOyVVfQY5luf0kpR3Fxh3pazQlU VttgRaEpA0lKmlZrHntC1dTt0OFLdQzR/xj3TF98aS1T0UsP4+08AlFkiNj3dU7iotO8 tdLTIPXqP8CBXO0BScyr9thK+gz+8WOI+kj0n0x3dWh9c1fTPbIVu3V1XJXkdZCg5K75 zGRo+GznLiWIp6Js6kHXY7lS1RfmuJJMUjDoE1FNEYB6DySB1iF2cH9rjA8vvnSD76Iq MoIjcDCedLVmXkOUGHwS2nJlLoONbkZA14FJLKFCMEdfcW6DGEcDmIhG38nL3npRDUzv N5xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=tuB9PNNGBdrtgxjPzbnq4e1RMAH2qhJJfR1+/49znvY=; b=GJ2lJWQ9N06UF66bJaaegU33afLu8xXax9jdTrG0/jsiimLjQZHzXtniP4joKZEaT4 6xN7WPGPMACXdPEyzM1HHDXG6wl2TaO2y19rLn3BTdifJHydoP7P0pxfUCAgwZ8rh3n0 wLlVgaz071lge2vnAahDvZkH0cURXa47P3sL3m0UBM576BF3+iQved8aSNAocn2WvOiw c2VnFRWeRDEv9FZf6qan8HGjEOpI9E4PCrYXZ7wPFM6q9XKSgjS5Z8NOcoCffvNN6tpd 0tCk88kXCIE1YeMFiq/iyEt5I7sjUJuflcnqNjp+gTywPNpPPo+GCsJjIyk96lFxZKk6 sHuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id 60si768341qtb.367.2019.03.20.00.35.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 00:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4948F58E45; Wed, 20 Mar 2019 07:35:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD6D96B499; Wed, 20 Mar 2019 07:35:47 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com, mhocko@suse.com, rppt@linux.vnet.ibm.com, richard.weiyang@gmail.com, linux-mm@kvack.org, Baoquan He Subject: [PATCH 1/3] mm/sparse: Clean up the obsolete code comment Date: Wed, 20 Mar 2019 15:35:38 +0800 Message-Id: <20190320073540.12866-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Mar 2019 07:35:54 +0000 (UTC) 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 code comment above sparse_add_one_section() is obsolete and incorrect, clean it up and write new one. Signed-off-by: Baoquan He --- mm/sparse.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 77a0554fa5bd..0a0f82c5d969 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -674,9 +674,12 @@ static void free_map_bootmem(struct page *memmap) #endif /* CONFIG_SPARSEMEM_VMEMMAP */ /* - * returns the number of sections whose mem_maps were properly - * set. If this is <=0, then that means that the passed-in - * map was not consumed and must be freed. + * sparse_add_one_section - add a memory section + * @nid: The node to add section on + * @start_pfn: start pfn of the memory range + * @altmap: device page map + * + * Return 0 on success and an appropriate error code otherwise. */ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, struct vmem_altmap *altmap) From patchwork Wed Mar 20 07:35:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 10860953 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 B39BC1390 for ; Wed, 20 Mar 2019 07:36:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9863029A38 for ; Wed, 20 Mar 2019 07:36:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C14429A43; Wed, 20 Mar 2019 07:36:01 +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 2D25529A38 for ; Wed, 20 Mar 2019 07:36:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD7336B0006; Wed, 20 Mar 2019 03:35:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D93E76B0007; Wed, 20 Mar 2019 03:35:59 -0400 (EDT) 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 C76276B0008; Wed, 20 Mar 2019 03:35:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id 9DCB66B0006 for ; Wed, 20 Mar 2019 03:35:59 -0400 (EDT) Received: by mail-qt1-f200.google.com with SMTP id e1so1480938qth.23 for ; Wed, 20 Mar 2019 00:35:59 -0700 (PDT) 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:message-id:in-reply-to:references; bh=w9cFJm+HEeCHcX9JqiAPkwlfm2xd5GqjMiIlH+9+Qg0=; b=o+pp9NGNKeQgICH5SZFTgptCUA2AacjhdtLYrA67CjmT7V4vrUNoRSjlne5/zD4Mn0 mZEUoioJc3Exrca5foS3DgY+UlQloab/Hvn7zSTY4PW+oakv7nVtzQIJIpY8gbcqkOwO jHM4WK3LDDE+VpfHDsOaWAX0FW/04octvmjf9ZqgNd0Ib63Kj8eMwZV7NCenEuTrIoV3 rWXtV3bB9exijQfrLywbLP1O4bKkwLkr0+itEyhYeXzIXiMITzWupclm7VckpHYnugcF ITx625gYBOjPsA8CMsCE9bNc/30TIMIO2HCuwfnj4wsx+ok44dycCMFrpp8bSzGM214T xJag== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAWBxeloQbNd6fdEgRE0ZrtEAzpU/AdbeD4LUNf7v4XJCZSgGTy5 fFnZVgR7dn2LU2xG7PsEUMysRvUr4WGpYse0ENlTHqNPG8fiECLgvrQRTysiW3Id5AMMK+KDOf5 QBWZ4YdAA76Gl+yAYn+oEBUmoUKNpzzTZ0JAvmZuh2rlMnehoNKVIE2dt1K+2dch/Hw== X-Received: by 2002:a0c:b756:: with SMTP id q22mr5323707qve.29.1553067359454; Wed, 20 Mar 2019 00:35:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1y47ZmSYVi1vB1k/kERkKHwoDTlClk0FG8sM1b8KI91zqyFzmT2YnZwWjBJQ2+aZGX+AD X-Received: by 2002:a0c:b756:: with SMTP id q22mr5323666qve.29.1553067358418; Wed, 20 Mar 2019 00:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553067358; cv=none; d=google.com; s=arc-20160816; b=ucmJox63D5fruFocblvCiLebkKMmVB+o8PmgKN+gB3GI0rFY9cQhV6fJTpBzK24/Xs zMjlQcJo5AYo91EE/fMeu3Gq1mJWM1OC9/kz2hnArEYFW0+8XSZde+I8zV+tQ6GIJzJp O5mh4b3956QvkPCv6Xyjy3ShlMxRuR31cqOgeweMSo3p8duSFlrDBqH2jGqHxXWxYZYi Fk3u3Wv9Fwqz3VwSXevoT+0gdqMiCiBPq+XWuL2xHAWNuHuMKcLEzNU3IGfBuBrNcUZQ WKqOy5J4pneokKjDrUIAxR151ABGza2p0jPVU7vEKJyQuOJab1w40Q9mPgckls8MuRbp 4LWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=w9cFJm+HEeCHcX9JqiAPkwlfm2xd5GqjMiIlH+9+Qg0=; b=LRUi5K+wUvxzJNQsBnEGHvTEVsI+4484XachMlRJklGNrrvb0Ni27tfvW0IIJY4b4a UHub1RUzOscraQrCydJx9Y3L6gEcorUEGwzwzmNo8ano7wU6x+Wf7ZSz1qwJWmWfMsW4 81QTU1YpPt8QKvIcCd19OGRGU2uX0TvsLZVd1m5xX4q5ZLBYp+k5nym9QGERmcA77gMr Aua6SHSv4PBkQxlh+FdyyQQWYlqvF0nap+sgKARTmCOpWGb04f5Cd1NiBiLc+lhOmuML EyrlvfQO+fdjYhUQ/0murD95h8QDmzb3Vm1B7zxhMmY205DzFdRWbWpWu/6Fnv0Rzs8z fF2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id l37si733250qte.317.2019.03.20.00.35.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 00:35:58 -0700 (PDT) Received-SPF: pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9578D31688EB; Wed, 20 Mar 2019 07:35:57 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8C4F60CD3; Wed, 20 Mar 2019 07:35:54 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com, mhocko@suse.com, rppt@linux.vnet.ibm.com, richard.weiyang@gmail.com, linux-mm@kvack.org, Baoquan He Subject: [PATCH 2/3] mm/sparse: Optimize sparse_add_one_section() Date: Wed, 20 Mar 2019 15:35:39 +0800 Message-Id: <20190320073540.12866-2-bhe@redhat.com> In-Reply-To: <20190320073540.12866-1-bhe@redhat.com> References: <20190320073540.12866-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 20 Mar 2019 07:35:57 +0000 (UTC) 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 Reorder the allocation of usemap and memmap since usemap allocation is much smaller and simpler. Otherwise hard work is done to make memmap ready, then have to rollback just because of usemap allocation failure. Signed-off-by: Baoquan He Signed-off-by: Baoquan He --- mm/sparse.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 0a0f82c5d969..054b99f74181 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -697,16 +697,17 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, ret = sparse_index_init(section_nr, nid); if (ret < 0 && ret != -EEXIST) return ret; - ret = 0; - memmap = kmalloc_section_memmap(section_nr, nid, altmap); - if (!memmap) - return -ENOMEM; + usemap = __kmalloc_section_usemap(); - if (!usemap) { - __kfree_section_memmap(memmap, altmap); + if (!usemap) + return -ENOMEM; + memmap = kmalloc_section_memmap(section_nr, nid, altmap); + if (!memmap) { + kfree(usemap); return -ENOMEM; } + ret = 0; ms = __pfn_to_section(start_pfn); if (ms->section_mem_map & SECTION_MARKED_PRESENT) { ret = -EEXIST; From patchwork Wed Mar 20 07:35:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 10860955 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 F3FC513B5 for ; Wed, 20 Mar 2019 07:36:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A7B29A40 for ; Wed, 20 Mar 2019 07:36:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4E3A29A38; Wed, 20 Mar 2019 07:36:08 +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 501E829A38 for ; Wed, 20 Mar 2019 07:36:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F97C6B0007; Wed, 20 Mar 2019 03:36:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A88B6B0008; Wed, 20 Mar 2019 03:36:07 -0400 (EDT) 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 598C96B000A; Wed, 20 Mar 2019 03:36:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id 3A2476B0007 for ; Wed, 20 Mar 2019 03:36:07 -0400 (EDT) Received: by mail-qk1-f200.google.com with SMTP id 23so20021087qkl.16 for ; Wed, 20 Mar 2019 00:36:07 -0700 (PDT) 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:message-id:in-reply-to:references; bh=NHYm78XeumLt8ir9csQDBL74SYZAX+2NrnzQ7Es7qeA=; b=RF0DUwHMZl+eaU1AE9c1ouzIPJh1lZjZcvALiTvUmHmu44uZkxcXtMkdVnIDHl9FsP dSdmkcSA7bBjSQ1E9VN2yhIo+ta1DN1+xErqMZpJeXQPTxBHq6yeI5d6DEPoLfLOfnHq 4vn4OOsdL/rLqMz+8o/tsQjmcmL1IKzoEoA22uiCpskiLrkk9Oqlul0fsmkew5qax8nd WSslZEWrtYADNIdqCqvpr8w9A6nVndS8KTOmF5eT07db1RtOtPHMbOWKzKcTBq91SL28 dBm5fh+pHVrZai4ItyND7pOCwUfZ1l5+Ayhz3p3/xNpOG8EYtpNLuJsa4FT0N6m1Wbdl vKhg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAVEhlUfasyhpot/+CPKFZ/caO9SH7mKOQoc/eoG4Ru00o/MRP5O pZEWvlcQlqXz1P6SIaal0IRB+ShOcAM9vFio0wkSbTIBl1f71sSg4ODRlXgm8WhTrlAHHouk0LC wzHi/7ta5ah6IsFEcZ4PvSwsCnPM7S8uKvSd0RleuQDGpzAeTdrW0On9F4mxMmWi9RQ== X-Received: by 2002:ac8:201:: with SMTP id k1mr5738828qtg.184.1553067367011; Wed, 20 Mar 2019 00:36:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTKu1vefQDB4q15xIW3cZJDASAG6h6QGgbvLKCtqM8XcrrqO52EKnLWE2DNKFQKDkdk0Vi X-Received: by 2002:ac8:201:: with SMTP id k1mr5738803qtg.184.1553067366299; Wed, 20 Mar 2019 00:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553067366; cv=none; d=google.com; s=arc-20160816; b=rVxCfJUWbWIztOo3tMnrZ+2d3D8oAfzGoYqd5G8uWwTQpSskvMJrH16zrJtCDvop2n c6PCKEyj3n/57yg4ls/lgl+hre/iLPnNpy55I3N+vH7fVCosURWvzfocotXQW4+z0LaT SfnyK/wkFT5vE/pO9I+4a7NNQ4vNFG8qVb2baNz+vf8l9HQDM2PbgkeIdZ36+IhOI3fQ dwrRKVA2FYxGYgOm1sqM3ofpULJ7/gJhi3gnrvGGu8hubUz5dVhJU8ipIotAsThPc9p5 Or1R+OAXsx5aS+ZLEkSaVVgbSoq022mxkp+CgZpSecYjxufL8Jfylr7so0V8KXjyan/R jo+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=NHYm78XeumLt8ir9csQDBL74SYZAX+2NrnzQ7Es7qeA=; b=xugeIA1xoconHtJB9xINNPayezwOYJRjolL6vJQSCHA4NJJFc8FPLmT9HaApeLKd4w gN0t0gTANyEoMhQFq9dSSoH4DhlN3gUKMVd/pi6TUavWUtFeEY3klCP18bAs5if+PHah 7tchxiLjckTiBNFxbM0gPO9jzmGIhB5xTg252YZzZOURFpRYKbwibQCmRPY3Y4Tfv7Rk l2RtIg8MrSpcef4yj9WQJflAAPMN26fEjpzEQ3MRJJsdXBQCNmzVMbUXrZMLfReUwwlG 5+8q/cQL8soR79TRunD8igojyKN+dfRr1Rn/dycVaMlcti0v7+2lu49S5gNFQSPYRlS6 x9VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t3si684642qkc.248.2019.03.20.00.36.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 00:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 824A5307D981; Wed, 20 Mar 2019 07:36:05 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8178F60BF3; Wed, 20 Mar 2019 07:36:00 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com, mhocko@suse.com, rppt@linux.vnet.ibm.com, richard.weiyang@gmail.com, linux-mm@kvack.org, Baoquan He Subject: [PATCH 3/3] mm/sparse: Rename function related to section memmap allocation/free Date: Wed, 20 Mar 2019 15:35:40 +0800 Message-Id: <20190320073540.12866-3-bhe@redhat.com> In-Reply-To: <20190320073540.12866-1-bhe@redhat.com> References: <20190320073540.12866-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 20 Mar 2019 07:36:05 +0000 (UTC) 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 These functions are used allocate/free section memmap, have nothing to do with kmalloc/free during the handling. Rename them to remove the confusion. Signed-off-by: Baoquan He --- mm/sparse.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 054b99f74181..374206212d01 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -579,13 +579,13 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) #endif #ifdef CONFIG_SPARSEMEM_VMEMMAP -static inline struct page *kmalloc_section_memmap(unsigned long pnum, int nid, +static inline struct page *alloc_section_memmap(unsigned long pnum, int nid, struct vmem_altmap *altmap) { /* This will make the necessary allocations eventually. */ return sparse_mem_map_populate(pnum, nid, altmap); } -static void __kfree_section_memmap(struct page *memmap, +static void __free_section_memmap(struct page *memmap, struct vmem_altmap *altmap) { unsigned long start = (unsigned long)memmap; @@ -603,7 +603,7 @@ static void free_map_bootmem(struct page *memmap) } #endif /* CONFIG_MEMORY_HOTREMOVE */ #else -static struct page *__kmalloc_section_memmap(void) +static struct page *__alloc_section_memmap(void) { struct page *page, *ret; unsigned long memmap_size = sizeof(struct page) * PAGES_PER_SECTION; @@ -624,13 +624,13 @@ static struct page *__kmalloc_section_memmap(void) return ret; } -static inline struct page *kmalloc_section_memmap(unsigned long pnum, int nid, +static inline struct page *alloc_section_memmap(unsigned long pnum, int nid, struct vmem_altmap *altmap) { - return __kmalloc_section_memmap(); + return __alloc_section_memmap(); } -static void __kfree_section_memmap(struct page *memmap, +static void __free_section_memmap(struct page *memmap, struct vmem_altmap *altmap) { if (is_vmalloc_addr(memmap)) @@ -701,7 +701,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, usemap = __kmalloc_section_usemap(); if (!usemap) return -ENOMEM; - memmap = kmalloc_section_memmap(section_nr, nid, altmap); + memmap = alloc_section_memmap(section_nr, nid, altmap); if (!memmap) { kfree(usemap); return -ENOMEM; @@ -726,7 +726,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, out: if (ret < 0) { kfree(usemap); - __kfree_section_memmap(memmap, altmap); + __free_section_memmap(memmap, altmap); } return ret; } @@ -777,7 +777,7 @@ static void free_section_usemap(struct page *memmap, unsigned long *usemap, if (PageSlab(usemap_page) || PageCompound(usemap_page)) { kfree(usemap); if (memmap) - __kfree_section_memmap(memmap, altmap); + __free_section_memmap(memmap, altmap); return; }