Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1986759pxk; Mon, 14 Sep 2020 01:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydHVJjighXT33S2+PlsezXGLuxq04aOop6Ymu2LDZHprgl3k5tUE1U+Vk+CbNJy17SXucF X-Received: by 2002:a17:906:3748:: with SMTP id e8mr10039762ejc.71.1600071756023; Mon, 14 Sep 2020 01:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600071756; cv=none; d=google.com; s=arc-20160816; b=EBTQ+HkbK+9v2o/VA7n++oJr81MA0u57Df0+mf0ugU4Mm1/d8D4WO0YwT9JcLSatZX jdVAHMBBremjPecNPGWRI4MDvDkLB+Utpbn+a+SCzFqP0QeNTsoLtBer1MszBwVVP820 98Ko2+PHX6j1LLNIOIcSHCkEkT+PnStCc0xvS3SqqOv1CtwG/23gpfq/ayjEvahp9hvM u4djnvjmUA90gO/D1DNZpgptlj38DqVPLQ8x9V2M1G/ItFy4TcrEzWonEx9d7ccRVqJR gn9Fl6qPGTefOtWYirX2S6MYXn3mRxrA9lfl4bo46M4aEXfK12gbv/o+EKWOcHzdHoca QESA== 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=E0r5/uE+pQBx+JxBvN9d1QzJYsVGtaukwQxfihw37Ns=; b=XagwguN6YK59XrJVX4wpdmYYmQY/pG/BPXnJa8aTdBXpaXQpZKGLGTCau5aIj+c9RO BOLDgRqcBTvdcwTCYHfcNaqUum7gPY7kr1Zyp+SUvdRwiFakP9aJWYbXyYNNXMlpWf8v S1AMRi4kTiC0HQfG6IvRw1UqdUVRL8qLDpCFDH7306t/a7+MaQGzizZwejt1x1glUP99 PmWllFf6HGn+jyYGyXhqQtbjdRX5SGZoCq9GGGSr46PTINtP96um436GvwlYNcSd3PgC hdhZXzk9nwlx+eEHs4p6b7l4itcVjYKQ2FGchkm+c2O9fs26OCS9brn99zereN769Qe1 HKBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m23si6480225ejo.333.2020.09.14.01.22.13; Mon, 14 Sep 2020 01:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726220AbgINITb (ORCPT + 99 others); Mon, 14 Sep 2020 04:19:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:59616 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbgINITb (ORCPT ); Mon, 14 Sep 2020 04:19:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5C04CAC46; Mon, 14 Sep 2020 08:19:45 +0000 (UTC) Date: Mon, 14 Sep 2020 10:19:26 +0200 From: Oscar Salvador To: David Hildenbrand Cc: Laurent Dufour , akpm@linux-foundation.org, mhocko@kernel.org, Greg Kroah-Hartman , linux-mm@kvack.org, "Rafael J . Wysocki" , nathanl@linux.ibm.com, cheloha@linux.ibm.com, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Michal Hocko Subject: Re: [PATCH 2/3] mm: don't rely on system state to detect hot-plug operations Message-ID: <20200914081921.GA15113@linux> References: <20200911134831.53258-1-ldufour@linux.ibm.com> <20200911134831.53258-3-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Sep 14, 2020 at 09:57:46AM +0200, David Hildenbrand wrote: > > /* register memory section under specified node if it spans that node */ > > +struct rmsun_args { > > + int nid; > > + enum memplug_context context; > > +}; Uhmf, that is a not so descriptive name. > Instead of handling this in register_mem_sect_under_node(), I > think it would be better two have two separate > register_mem_sect_under_node() implementations. > > static int register_mem_sect_under_node_hotplug(struct memory_block *mem_blk, > void *arg) > { > const int nid = *(int *)arg; > int ret; > > /* Hotplugged memory has no holes and belongs to a single node. */ > mem_blk->nid = nid; > ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj, > &mem_blk->dev.kobj, > kobject_name(&mem_blk->dev.kobj)); > if (ret) > returnr et; > return sysfs_create_link_nowarn(&mem_blk->dev.kobj, > &node_devices[nid]->dev.kobj, > kobject_name(&node_devices[nid]->dev.kobj)); > > } > > Cleaner, right? :) No unnecessary checks. I tend to agree here, I like more a simplistic version for hotplug. > One could argue if link_mem_section_hotplug() would be better than passing around the context. I am not sure if I would duplicate the code there. We could just pass the pointer of the function we want to call to link_mem_sections? either register_mem_sect_under_node_hotplug or register_mem_sect_under_node_early? Would not that be clean and clear enough? -- Oscar Salvador SUSE L3