Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4652694ybi; Mon, 3 Jun 2019 14:50:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwddsYAX92v8ec4jt5dfBBQ1jBOw9xbtBrHtCq35p49lk5gaNO632PJcyK+vWOzelWTEShj X-Received: by 2002:a17:902:ac98:: with SMTP id h24mr25628594plr.79.1559598657694; Mon, 03 Jun 2019 14:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559598657; cv=none; d=google.com; s=arc-20160816; b=OoDlb5VePMlQ9HdDt7IqoONLiC73nHW0FAmZxDLZ+zGBBmwX6ORj2zMI/CmYA0/8zF OJ5UVCTI9qus+cHPG5342BQgaOHIh0hBHqdJ/q/XODIr8BKxIHfjPxNB/wp7uOw5ClFv 5cLlibFOg+zUqzJliNymOY3ZYv4PhVEO0eVKAj8v2ItFxRpQpoKSRQzHT9qXWaGkDSzr E2pgVay8YbS+AHO0OU+XuvioV5KyDYshWDemBEAmXvc5O82mzTeQuVD2Yldk72Jf+SHS Cs1ff++CaRwFgCFcNk3vFYiHP8+V/lyh3ZTLP9xo9pOPWbIGIBYlpIiahNOLZHxzYYt1 DdmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=jSb30N0jvHoftFPeqnRT0DDU5guICPUBTZ+cum9JlR4=; b=KpppnPXIwq0v0XsEL4J+KA1K7Z1AQ9EldWcLyQAOhMpxmjvOaA/nCuTQ3g+qJ6oM+M m2L+UosUfCH4mjobL+I7Lr8TmZLzJN680T6WdVBf7S5DyUFBRugykFc1nluzTljZDrYz 8QN+9j8EaJABae5rdRLDjkxu6oRUuofYkwyhso2JqNhkojY2Q/qk8Ce/jGvWk0wQJvXs yTIHGLtI1kMS/Y/WIPSjOOUrFDF+agM8gTrYxAmAKa/sYsWSXz2Matodl+FQhdstpIEn 7jMn/v9+hvrIP47AJb+nOKFpJLsnafgRzOMrB2EB9O0tDByQLt3iJAL+eb/G4Vd4slrX 98ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mgXqHJD2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si20062108pgv.513.2019.06.03.14.50.41; Mon, 03 Jun 2019 14:50:57 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=mgXqHJD2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbfFCVtg (ORCPT + 99 others); Mon, 3 Jun 2019 17:49:36 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42726 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfFCVtf (ORCPT ); Mon, 3 Jun 2019 17:49:35 -0400 Received: by mail-ed1-f65.google.com with SMTP id z25so2864664edq.9; Mon, 03 Jun 2019 14:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jSb30N0jvHoftFPeqnRT0DDU5guICPUBTZ+cum9JlR4=; b=mgXqHJD2asQbJ2oQs51g/wKDUPSvM+cdNOzAPTyJufLHFAJ19jz11IiehaMBP9Q8ik U7cGojJDSlIkY3XlU1wbDp/ZvfgCPH2xtvqbe8RTcqyW4RgEYqKYfvzgUXPExUHfWphX l6AEhObQDHlSi21ygsz20Rc+h9b47N32S+aUh7dW5enm+vZUggpdxoXVUyuZMF5MtWwu HvQgRVJ2g/tV3CdwcqyDzfDmGbDOJgMVhPQtiAPMWcP+2I1nYtbVep68GhMqaZszwkMu ZoMyIv97BEMZtXBzKLTZmelReybdKtsgdltfFU51nMZzyYEnx+zhis0dtU/Ii/M4+PfR vrDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=jSb30N0jvHoftFPeqnRT0DDU5guICPUBTZ+cum9JlR4=; b=j/w/YqFMJVKc+N4HOxL9Ycgncj+YQcIbHaLhxFJcCtft0530EWSYoCDp5/CRyzt/TY fbRgMlLOkXbbctJcu4iYJDAhAxfc6D19RYy8obc7qsiOZYejG2jxorqaRDQHqnzR7yV2 hFv1Y7pBm3oiTKbod7Q8zzV5P5tnEnlSjwCbJTXaD3oMhojosGQPH6gvWtxQOrMC4Cnf qmkJPYIhxTj7LuORRSldylSRmFbGz2nQEuYQfM/04ISS7gTutvpAyH55g+26oonNLSwV rp3TgeTo3eN9IogWHVXd/nQs0u74bsAsU0J6qYmLJtD1X4PyiYU4WDXSHnwVE/eUxtuh mVTw== X-Gm-Message-State: APjAAAU0Kqq0cVk6Kvg7QTN6RI59VNy/pAeJvGv5LxcQeStcb23oa4Gg NJbO7ZM150kwuCsfwRcpOeM= X-Received: by 2002:aa7:c645:: with SMTP id z5mr31432297edr.43.1559598573674; Mon, 03 Jun 2019 14:49:33 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id d5sm1533710edr.8.2019.06.03.14.49.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 14:49:32 -0700 (PDT) Date: Mon, 3 Jun 2019 21:49:32 +0000 From: Wei Yang To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, Dan Williams , Wei Yang , Igor Mammedov , Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: Re: [PATCH v3 05/11] drivers/base/memory: Pass a block_id to init_memory_block() Message-ID: <20190603214932.3xsvxwiiutcve4tz@master> Reply-To: Wei Yang References: <20190527111152.16324-1-david@redhat.com> <20190527111152.16324-6-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190527111152.16324-6-david@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 27, 2019 at 01:11:46PM +0200, David Hildenbrand wrote: >We'll rework hotplug_memory_register() shortly, so it no longer consumes >pass a section. > >Cc: Greg Kroah-Hartman >Cc: "Rafael J. Wysocki" >Signed-off-by: David Hildenbrand >--- > drivers/base/memory.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > >diff --git a/drivers/base/memory.c b/drivers/base/memory.c >index f180427e48f4..f914fa6fe350 100644 >--- a/drivers/base/memory.c >+++ b/drivers/base/memory.c >@@ -651,21 +651,18 @@ int register_memory(struct memory_block *memory) > return ret; > } > >-static int init_memory_block(struct memory_block **memory, >- struct mem_section *section, unsigned long state) >+static int init_memory_block(struct memory_block **memory, int block_id, >+ unsigned long state) > { > struct memory_block *mem; > unsigned long start_pfn; >- int scn_nr; > int ret = 0; > > mem = kzalloc(sizeof(*mem), GFP_KERNEL); > if (!mem) > return -ENOMEM; > >- scn_nr = __section_nr(section); >- mem->start_section_nr = >- base_memory_block_id(scn_nr) * sections_per_block; >+ mem->start_section_nr = block_id * sections_per_block; > mem->end_section_nr = mem->start_section_nr + sections_per_block - 1; > mem->state = state; > start_pfn = section_nr_to_pfn(mem->start_section_nr); >@@ -694,7 +691,8 @@ static int add_memory_block(int base_section_nr) > > if (section_count == 0) > return 0; >- ret = init_memory_block(&mem, __nr_to_section(section_nr), MEM_ONLINE); >+ ret = init_memory_block(&mem, base_memory_block_id(base_section_nr), >+ MEM_ONLINE); If my understanding is correct, section_nr could be removed too. > if (ret) > return ret; > mem->section_count = section_count; >@@ -707,6 +705,7 @@ static int add_memory_block(int base_section_nr) > */ > int hotplug_memory_register(int nid, struct mem_section *section) > { >+ int block_id = base_memory_block_id(__section_nr(section)); > int ret = 0; > struct memory_block *mem; > >@@ -717,7 +716,7 @@ int hotplug_memory_register(int nid, struct mem_section *section) > mem->section_count++; > put_device(&mem->dev); > } else { >- ret = init_memory_block(&mem, section, MEM_OFFLINE); >+ ret = init_memory_block(&mem, block_id, MEM_OFFLINE); > if (ret) > goto out; > mem->section_count++; >-- >2.20.1 -- Wei Yang Help you, Help me