From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27A4CC433E2 for ; Thu, 10 Sep 2020 14:40:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C240F20BED for ; Thu, 10 Sep 2020 14:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C240F20BED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 21EFB6B007D; Thu, 10 Sep 2020 10:40:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CEC06B007E; Thu, 10 Sep 2020 10:40:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E60F6B0080; Thu, 10 Sep 2020 10:40:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id E9ECB6B007D for ; Thu, 10 Sep 2020 10:40:20 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1D5C180AD807 for ; Thu, 10 Sep 2020 14:40:20 +0000 (UTC) X-FDA: 77247412200.14.light98_46125fc270e6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 7EEB518229837 for ; Thu, 10 Sep 2020 14:40:20 +0000 (UTC) X-HE-Tag: light98_46125fc270e6 X-Filterd-Recvd-Size: 3155 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Sep 2020 14:40:19 +0000 (UTC) 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 747A6B333; Thu, 10 Sep 2020 14:40:34 +0000 (UTC) Date: Thu, 10 Sep 2020 16:40:18 +0200 From: Michal Hocko To: Oscar Salvador Cc: Laurent Dufour , akpm@linux-foundation.org, David Hildenbrand , rafael@kernel.org, nathanl@linux.ibm.com, cheloha@linux.ibm.com, stable@vger.kernel.org, Greg Kroah-Hartman , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: don't rely on system state to detect hot-plug operations Message-ID: <20200910144018.GK28354@dhcp22.suse.cz> References: <74a62b00-235e-7deb-2814-f3b240fea25e@linux.ibm.com> <20200910072331.GB28354@dhcp22.suse.cz> <31cfdf35-618f-6f56-ef16-0d999682ad02@linux.ibm.com> <20200910111246.GE28354@dhcp22.suse.cz> <20200910120343.GA6635@linux> <20200910124755.GG28354@dhcp22.suse.cz> <20200910124847.GH28354@dhcp22.suse.cz> <20200910133854.GA8713@linux> <20200910135106.GI28354@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910135106.GI28354@dhcp22.suse.cz> X-Rspamd-Queue-Id: 7EEB518229837 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: On Thu 10-09-20 15:51:07, Michal Hocko wrote: > On Thu 10-09-20 15:39:00, Oscar Salvador wrote: > > On Thu, Sep 10, 2020 at 02:48:47PM +0200, Michal Hocko wrote: [...] > > > Forgot to ask one more thing. Who is going to online that memory when > > > userspace is not running yet? > > > > Depends, if you have CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE set or you specify > > memhp_default_online_type=[online,online_*], memory will get onlined right > > after hot-adding stage: > > > > /* online pages if requested */ > > if (memhp_default_online_type != MMOP_OFFLINE) > > walk_memory_blocks(start, size, NULL, online_memory_block); > > > > If not, systemd-udev will do the magic once the system is up. > > Does that imply that we need udev to scan all existing devices and > reprobe them? I've checked the sysfs side of things and it seems that the KOBJ_ADD event gets lost because there are no listeners (create_memory_block_devices -> .... -> device_register -> ... -> device_add -> kobject_uevent(&dev->kobj, KOBJ_ADD) -> kobject_uevent_net_broadcast). So the only way to find out about those devices once the init is up and something than intercept those events is to rescan devices. This is really unfortunate because this solution really doesn't scale with most usecases which do not do early boot hotplug and this can get more than interesting on machines like ppc which have gazillions of memory block devices because they use insanly small blocks and just imagine a multi TB machine how that scales. Sigh... -- Michal Hocko SUSE Labs