Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2134847imm; Thu, 19 Jul 2018 13:54:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcbhodhjbbZRl0wiSU4fI1nSQ+Jhf84Ae/Zi75z4uP5g4uHevHtsqvnGiegZr+trR0eCuNG X-Received: by 2002:a62:9f85:: with SMTP id v5-v6mr11041229pfk.27.1532033655002; Thu, 19 Jul 2018 13:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532033654; cv=none; d=google.com; s=arc-20160816; b=XHu3BGETaDnNSNXYPRqSuz8qUR0RlWGNnAzrILB385/w67Kof4aEVqJfyJeh41iaEF s0jqJe8OHkM6fzff+NXk5zDqEzpusRuFYCz7klRBkHY7r90LzUkXCMK20E3YP0Ot8Hlu 272eUppT7xzsb6cLa7lhinLmmwLtCr1rDqX5tOeTRolkI2yZpfNsfOz/z05Ur1/+y743 n2D8mWgpv4YkP8UjdZ+rSITFxbj4cuiM+tb1YWAC3COux6X0kXNs0hJRzzri+iB5D/05 /PkgYbLZLJcrPQWtP1+8mCA28Nsnr0LN4iR/pwqNQFaXGce22oXgTf2EIq4aU/mTWV3F K4rQ== 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:arc-authentication-results; bh=RuRQobfna1gFuE+SiuGl+tZbbFsIbAQ3ocQMrEiC49A=; b=VeN0kKMhd8TW9pqHaucvMTMXksLhc9THxTWJt87oyxuzEB4EyBUwpivRNr7867marm 5OOA8IP96Vrz849GgnEVFPYtJMsWVFPdj6m+lblP+C8rYf17MYV1HrhiDiiKNv9OhiZ6 RsMD/I2oS5LjS5XafPahQnLMIXtCWj9FrxV70Vq4M1cPKc5uZuSnLBM68maWqX71SlaW ZJ4PKbv9758NwY4yXciPHLM8F2YisjracvN5IEqqgzqZ5EtuYyH8KzGlEaLw3c02YwSp UV6Q+lc58r0836EbPwZI9CMyDQhVaBEyKT8sLzI2r7SDSzVC4nujgr2123TNA0LKOdyq GE7w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si78214pld.429.2018.07.19.13.53.59; Thu, 19 Jul 2018 13:54:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730382AbeGSVh1 (ORCPT + 99 others); Thu, 19 Jul 2018 17:37:27 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46049 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727609AbeGSVh0 (ORCPT ); Thu, 19 Jul 2018 17:37:26 -0400 Received: by mail-wr1-f68.google.com with SMTP id c4-v6so9308727wrs.12 for ; Thu, 19 Jul 2018 13:52:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RuRQobfna1gFuE+SiuGl+tZbbFsIbAQ3ocQMrEiC49A=; b=CLmiPp6ahmEhieIF06m5R+WcBT/y3EZ8jP8WWVRTyRGJPbeAtfEeDuB99YYufvjB1n cFcDlS3tUHx9EKOXelEWr4tH9SwSy6dAuvG/61xSXFGu4PamWQVopCIZGgtA5+Z3QiVY MfcF3jLLb+yAcpTDL1VwcWF5MqWv4AlKcK/zf8afx6QPX/VmYHKbVlk3+3Ob9XbQmPjE QHKugdOhdAHP0Fbb3nc2YYVDt3vTWhE2co1436869zj4Xf6OFnUXVHOibe7nU0Lfw2yH RNAhzkKM2ye5lj7YHchqj8ZIMdiVTIVmcvYIm/IE+dtpRVFovwiDWACDvb8L+eRq4ieq GR3Q== X-Gm-Message-State: AOUpUlGuO96YczwxeihucYR1QUGhMH7jzD6k9e4Yo9C+4Ex48yCHiSRW JzvdTdVFaMgPlR3ZUpylqpi683s2N7o= X-Received: by 2002:a5d:4210:: with SMTP id n16-v6mr8088100wrq.55.1532033556651; Thu, 19 Jul 2018 13:52:36 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id h1-v6sm80631wri.90.2018.07.19.13.52.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 13:52:35 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 615141241AE; Thu, 19 Jul 2018 22:52:35 +0200 (CEST) Date: Thu, 19 Jul 2018 22:52:35 +0200 From: Oscar Salvador To: Michal Hocko Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com, vbabka@suse.cz, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: Re: [PATCH v2 3/5] mm/page_alloc: Optimize free_area_init_core Message-ID: <20180719205235.GA14010@techadventures.net> References: <20180719132740.32743-1-osalvador@techadventures.net> <20180719132740.32743-4-osalvador@techadventures.net> <20180719134417.GC7193@dhcp22.suse.cz> <20180719140327.GB10988@techadventures.net> <20180719151555.GH7193@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180719151555.GH7193@dhcp22.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 19, 2018 at 05:15:55PM +0200, Michal Hocko wrote: > Your changelog doesn't really explain the motivation. Does the change > help performance? Is this a pure cleanup? Hi Michal, Sorry to not have explained this better from the very beginning. It should help a bit in performance terms as we would be skipping those condition checks and assignations for zones that do not have any pages. It is not a huge win, but I think that skipping code we do not really need to run is worh to have. > The function is certainly not an example of beauty. It is more an > example of changes done on top of older ones without much thinking. But > I do not see your change would make it so much better. I would consider > it a much nicer cleanup if it was split into logical units each doing > one specific thing. About the cleanup, I thought that moving that block of code to a separate function would make the code easier to follow. If you think that this is still not enough, I can try to split it and see the outcome. > Btw. are you sure this change is correct? E.g. > /* > * Set an approximate value for lowmem here, it will be adjusted > * when the bootmem allocator frees pages into the buddy system. > * And all highmem pages will be managed by the buddy system. > */ > zone->managed_pages = is_highmem_idx(j) ? realsize : freesize; > > expects freesize to be calculated properly and just from quick reading > the code I do not see why skipping other adjustments is ok for size > 0. > Maybe this is OK, I dunno and my brain is already heading few days off > but a real cleanup wouldn't even make me think what the heck is going on > here. This changed in commit e69438596bb3e97809e76be315e54a4a444f4797. Current code does not have "realsize" anymore. Thanks -- Oscar Salvador SUSE L3