From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224bwZAzMe/BpX1n+vOc+LaBiDDSvJPu3Mam8RxcFFNoP1eOYzUhi3nflsINi29T4FPCUMrU ARC-Seal: i=1; a=rsa-sha256; t=1517388194; cv=none; d=google.com; s=arc-20160816; b=cInC/PR2BOfgCWr/jWo+24/CuHbmcWsjp3Ro0YNXXlJMAV6pe6Z1asDi0idlvYx6OW tCkSee8udA4YDPlp2vHKYEFTSHS8FtUuWJ4H0167iIEEJBtRcCLprRjjkV7kHlUDFpzc yiMzFAQ3SV5Y5572lRtnair4SmyePrFzpM7gkmTZdPOThlr/DvJCirgiii2gqQleD3D3 qsJSU69DrTHgDGJ8MiEder/Hvzd7EW7Vo1LhhsJOZ6xbHaUi9sTf/mfBznPaGt7r7rRF YPuidxsWSXR4rouENcDJsoPWNzCNS11KVvYICEFuKMn6JhR9eXBqpoNPJDfNtLKj3Pr6 9NCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:arc-authentication-results; bh=zR7FqHCYocTRP+GtwOdOmunIczueCR5nUXEcN0/bT2E=; b=fMANj28D85JF1Z4aBOJqNAwyzjMU8nd52r8Eq3CeILMRlBfZ2NF29scbu3YNeBnjRG QGDgZ6NNV3KSU8K+aEaALWUtOZZYKY7Iv0UKWaS3Usru79Yxx6JbYgZevLbnjRPW18qY Ly/rIXV4ZMCQNEjoyz7pc3LtnxSKQ5m++snzjpBeVFotIjMEGiULTjxbHT0z3VxpKBHW PYwkGvxoDW4n5cvbWakJiOF0gREoOvxMsXb5lJMm7n/4ex7Y3x/YOAjie0sJRy/OK/7q RwxneGFHF6SV1093hUyfmAm3DB+eEzCs/GzRUMzNCfFfT30lKHlvV/+QmZ15IdoS+TlW FmgA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 195.135.220.15 is neither permitted nor denied by best guess record for domain of mhocko@kernel.org) smtp.mailfrom=mhocko@kernel.org Authentication-Results: mx.google.com; spf=neutral (google.com: 195.135.220.15 is neither permitted nor denied by best guess record for domain of mhocko@kernel.org) smtp.mailfrom=mhocko@kernel.org Date: Wed, 31 Jan 2018 09:43:13 +0100 From: Michal Hocko To: Pavel Tatashin Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, akpm@linux-foundation.org, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, vbabka@suse.cz, bharata@linux.vnet.ibm.com Subject: Re: [PATCH v1] mm: optimize memory hotplug Message-ID: <20180131084313.GP21609@dhcp22.suse.cz> References: <20180131054243.28141-1-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180131054243.28141-1-pasha.tatashin@oracle.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1591085498196089078?= X-GMAIL-MSGID: =?utf-8?q?1591096843343028961?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Wed 31-01-18 00:42:43, Pavel Tatashin wrote: > This patch was inspired by the discussion of this problem: > http://lkml.kernel.org/r/20180130083006.GB1245@in.ibm.com > > Currently, during memory hotplugging we traverse struct pages several > times: > > 1. memset(0) in sparse_add_one_section() > 2. loop in __add_section() to set do: set_page_node(page, nid); and > SetPageReserved(page); > 3. loop in pages_correctly_reserved() to check that SetPageReserved is set. > 4. loop in memmap_init_zone() to call __init_single_pfn() > > This patch removes loops 1, 2, and 3 and only leaves the loop 4, where all > struct page fields are initialized in one go, the same as it is now done > during boot. So how do we check that there is no page_to_nid() user before we online the page? I remember I was fighting strange bugs when reworking this code. I have forgot all the details of course, I just remember some nasty and subtle code paths. Maybe we have got rid of those in the past year but this should be done really carefully. We might have similar dependences on PageReserved. That being said, it would be great if we could simplify this. I think that 3) can be removed right away. It is a pure paranoia. -- Michal Hocko SUSE Labs