From patchwork Mon Mar 16 10:21:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11440077 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7751B6CA for ; Mon, 16 Mar 2020 10:22:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43B4D2071C for ; Mon, 16 Mar 2020 10:22:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RDuLU9Cs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43B4D2071C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4ADFA6B0007; Mon, 16 Mar 2020 06:22:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 486326B0008; Mon, 16 Mar 2020 06:22: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 328236B000A; Mon, 16 Mar 2020 06:22:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 1B6336B0007 for ; Mon, 16 Mar 2020 06:22:07 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EC64352C1 for ; Mon, 16 Mar 2020 10:22:06 +0000 (UTC) X-FDA: 76600835052.17.truck00_126e3087d0a12 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30054,0,RBL:207.211.31.120:@redhat.com:.lbl8.mailshell.net-66.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: truck00_126e3087d0a12 X-Filterd-Recvd-Size: 3276 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 16 Mar 2020 10:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584354126; 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=Vv1cQFCqZ1YUMKAqTsznQf04tGJGAJ2S0nm59ugBb9M=; b=RDuLU9CsZLay8jtw/Np1tXxnT8qO3VLDX+3NNlsxkI9SMVxOXUVyhRkcuJVRBD8pXJWTnb diXYO0sv7oGNZL5LIpc3mRB8vUtOqUiXI8LJeiY0xaPL/yH2xEeTzCnCzdPR2TIa8EYUHg SP2H6KCNlOsE/rBUDjJNqaIeHWAyevc= 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-455-JE4Ec69iOQOXSHxLJsY6Rw-1; Mon, 16 Mar 2020 06:22:03 -0400 X-MC-Unique: JE4Ec69iOQOXSHxLJsY6Rw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACBCBDBCB; Mon, 16 Mar 2020 10:22:01 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-129.pek2.redhat.com [10.72.12.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F9BF1BC6D; Mon, 16 Mar 2020 10:21:58 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, mhocko@suse.com, akpm@linux-foundation.org, david@redhat.com, willy@infradead.org, richard.weiyang@gmail.com, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH v4 2/2] mm/sparse.c: allocate memmap preferring the given node Date: Mon, 16 Mar 2020 18:21:50 +0800 Message-Id: <20200316102150.16487-2-bhe@redhat.com> In-Reply-To: <20200316102150.16487-1-bhe@redhat.com> References: <20200316102150.16487-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: When allocating memmap for hot added memory with the classic sparse, the specified 'nid' is ignored in populate_section_memmap(). While in allocating memmap for the classic sparse during boot, the node given by 'nid' is preferred. And VMEMMAP prefers the node of 'nid' in both boot stage and memory hot adding. So seems no reason to not respect the node of 'nid' for the classic sparse when hot adding memory. Use kvmalloc_node instead to use the passed in 'nid'. Signed-off-by: Baoquan He Acked-by: Michal Hocko --- mm/sparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index d01d09cc7d99..513d765e8c72 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -719,8 +719,8 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap) { - return kvmalloc(array_size(sizeof(struct page), - PAGES_PER_SECTION), GFP_KERNEL); + return kvmalloc_node(array_size(sizeof(struct page), + PAGES_PER_SECTION), GFP_KERNEL, nid); } static void depopulate_section_memmap(unsigned long pfn, unsigned long nr_pages,