Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1828929ybi; Mon, 1 Jul 2019 00:58:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBZfzOpVwLB0wN2JQhPc0jPLr0E7lBfSCruMP3C++PIu4uFHk9bb9/ysi221nDJk0wlXAl X-Received: by 2002:a17:90a:bd0b:: with SMTP id y11mr17926411pjr.141.1561967889118; Mon, 01 Jul 2019 00:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561967889; cv=none; d=google.com; s=arc-20160816; b=J8oQyOqLxnhUTd4D3+A953TSESeTIAzXg3mzq8qOhc8NwWWSpP42F0bNFYu1iKfwbL tNBbBCM3OPFFX495lz/TELa5m5T4EYvp2QdX6krO8dQjzFstdujSp6O31fKqFcfo0A6O 1ZTfmOQ2W4IvMWoviYNSIUJEjqLouLAlTW+QnGsD9nv8w/jht+AB4gOGkuy14RbKYzMf muVUtiQulhqW89iq8vcZUoZ0cRWS5xR2tGWIgQu9bAMl5Ih0hv4E4tNPZi1tSP+Wr6q/ dZl1Pr+7lpJeEgdfu3ZqB33eGrxqUXzBgs9bmt2xow/mPjWllfWiBw/+A++DYRh+0Uz+ AL9g== 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:message-id:subject:cc :to:from:date; bh=COUa2mpX659Jaq7DpTF8hgwf7cleVmC4D7dRZmILxtQ=; b=U87Cd1/f9+NHmJQEyGDkQueoNYcBQO4eVkx+h7MqdS2IQboTdMK9J0IPMQoMJRJlEm DoIbK6O2g5yfI2/0nss4i+0MNvafEy6DEpPUW8w7KGx4RhshuYZBrXIzzXZKQMtHCFj/ o52aZZf8PDhFa7ikxnr4tAfrdYkJgenzvU/oGUfTxq8VkDHgcqXo/zFM+P6GSvumV1S9 ocHxqWmkY07niuZESii7AcaCDkzjsFh5b0HYoL2n8KXFwxbxjSxoMfQ1sVsCYn3Gv1JJ RZq9E4OG++Kylp5N2HW1aSNxyjgyuPaHhs/OjCLRq/au21WfKz0r4gCtlsi878tngM/S K5CQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si9189169pgr.475.2019.07.01.00.57.53; Mon, 01 Jul 2019 00:58:09 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727557AbfGAH4R (ORCPT + 99 others); Mon, 1 Jul 2019 03:56:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:54224 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726036AbfGAH4R (ORCPT ); Mon, 1 Jul 2019 03:56:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9AD85AEBD; Mon, 1 Jul 2019 07:56:15 +0000 (UTC) Date: Mon, 1 Jul 2019 09:56:15 +0200 From: Michal Hocko 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: <20190701075615.GE6376@dhcp22.suse.cz> 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: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 27-05-19 13:11:46, 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 Acked-by: Michal Hocko > --- > 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 (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 -- Michal Hocko SUSE Labs