From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756551AbdKCNxx (ORCPT ); Fri, 3 Nov 2017 09:53:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:35522 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755987AbdKCNxw (ORCPT ); Fri, 3 Nov 2017 09:53:52 -0400 Date: Fri, 3 Nov 2017 14:53:49 +0100 From: Michal Hocko To: Pavel Tatashin Cc: Steve Sistare , Daniel Jordan , Andrew Morton , mgorman@techsingularity.net, Linux Memory Management List , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] mm: buddy page accessed before initialized Message-ID: <20171103135349.gsotgdjwo5sqe47y@dhcp22.suse.cz> References: <20171102170221.7401-1-pasha.tatashin@oracle.com> <20171102170221.7401-2-pasha.tatashin@oracle.com> <20171103092703.63qyafmg7rnpoqab@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 03-11-17 09:47:30, Pavel Tatashin wrote: > Hi Michal, > > There is a small regression, on the largest x86 machine I have access to: > Before: > node 1 initialised, 32471632 pages in 901ms > After: > node 1 initialised, 32471632 pages in 1128ms > > One node contains 128G of memory (overal 1T in 8 nodes). This > regression is going to be solved by this work: > https://patchwork.kernel.org/patch/9920953/, other than that I do not > know a better solution. The overall performance is still much better > compared to before this project. OK, I think that is completely acceptable for now. We can always optimize for a better result later. > Also, thinking about this problem some more, it is safer to split the > initialization, and freeing parts into two functions: > > In deferred_init_memmap() > 1574 for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &spa, &epa, NULL) { > 1575 spfn = max_t(unsigned long, first_init_pfn, PFN_UP(spa)); > 1576 epfn = min_t(unsigned long, zone_end_pfn(zone), > PFN_DOWN(epa)); > 1577 nr_pages += deferred_init_range(nid, zid, spfn, epfn); > 1578 } > > Replace with two loops: > First loop, calls a function that initializes the given range, the 2nd > loop calls a function that frees it. This way we won't get a potential > problem where buddy page is computed from the next range that has not > yet been initialized. And it is also going to be easier to multithread > later: multi-thread the first loop, wait for it to finish, > multi-thread the 2nd loop wait for it to finish. OK, but let's do that as a separate patch. What you have here is good for now IMHO. My ack applies. Thanks! -- Michal Hocko SUSE Labs