Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1814659imm; Thu, 19 Jul 2018 08:16:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOYdXJiT7YhQqMsidCuqT3V6EbXm9GXWulq9paP+HhFKpWaFE2SDwUHj6UlAQmcgZZdcnL X-Received: by 2002:a17:902:542:: with SMTP id 60-v6mr3240462plf.122.1532013409920; Thu, 19 Jul 2018 08:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532013409; cv=none; d=google.com; s=arc-20160816; b=ivtwKgBepFrdZq+jQ2XEfuiijs7btYNxM4AIoEh4YYDbI03uSCwsBTS2fNdqFHFzWx w2TMveUFMPhpj3Zx4S6kPVVqslItX/Q4JXE0Ao2wIW8gw5mZHLUWKAHZG+y7UpbyWc2q /aqTrBPRHQ19ArG/TJiVn2yi42ZPj/A9O8J5uczkqXTlTP7h4yUfUhpnESEczptIODmc 3nVdY0Kqo6U0e4OHfDsBNw8wDo6DpbpOPwKDopnWrDOSTttZlaXSdAM5o4WNSyerdJ2f JvW+GoiQBxAseHmKDkfSVuFKh0kT0ACGeGjzl21U7cBLiikDWozStW1ZiFjptLb4KnFi iiUg== 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=ZBmrBDgKxnHqIxgFcFpPHoahcKWl+SLxyYAwKiydyU4=; b=TNLUdgwGcE8MyT6MEy23RhkmURQnYZnSakVaqBUYDcV6Jfjt4TFfBSq3T4yXef5Mbc RyCvQau6YsVd2xebwoRBx1kwpnrxwx/sO3Oh/GduSjo52Ypa68nkahxMJtBTGkFV5pwc /eN18Qv+O9Zzn2KvL1iFtq2X53/qMce6MEOG9FKPodDTv+5U4Tkgg6iUGPrpa+qpzHI/ t3jNvv0V3y62fZT4dPGs7iPqEMF0oI7VdgbK0w2GT8vEFocP9i4MA8rcw4qmrb1XbCo5 Fv9zjrQNnT6W/NhUnopl9WeGP+vVlajmWXj0nzlsENJ+YzbEuHooT+0a3OYJs3h9sijN WL7A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23-v6si6027858pfk.25.2018.07.19.08.16.34; Thu, 19 Jul 2018 08:16:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731784AbeGSP7h (ORCPT + 99 others); Thu, 19 Jul 2018 11:59:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:46462 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730521AbeGSP7h (ORCPT ); Thu, 19 Jul 2018 11:59:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E1ECCAFC8; Thu, 19 Jul 2018 15:15:57 +0000 (UTC) Date: Thu, 19 Jul 2018 17:15:55 +0200 From: Michal Hocko To: Oscar Salvador 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: <20180719151555.GH7193@dhcp22.suse.cz> References: <20180719132740.32743-1-osalvador@techadventures.net> <20180719132740.32743-4-osalvador@techadventures.net> <20180719134417.GC7193@dhcp22.suse.cz> <20180719140327.GB10988@techadventures.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180719140327.GB10988@techadventures.net> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 19-07-18 16:03:27, Oscar Salvador wrote: > On Thu, Jul 19, 2018 at 03:44:17PM +0200, Michal Hocko wrote: > > On Thu 19-07-18 15:27:38, osalvador@techadventures.net wrote: > > > From: Oscar Salvador > > > > > > In free_area_init_core we calculate the amount of managed pages > > > we are left with, by substracting the memmap pages and the pages > > > reserved for dma. > > > With the values left, we also account the total of kernel pages and > > > the total of pages. > > > > > > Since memmap pages are calculated from zone->spanned_pages, > > > let us only do these calculcations whenever zone->spanned_pages is greather > > > than 0. > > > > But why do we care? How do we test this? In other words, why is this > > worth merging? > > Uhm, unless the values are going to be updated, why do we want to go through all > comparasions/checks? > I thought it was a nice thing to have the chance to skip that block unless we are going to > update the counters. > > Again, if you think this only adds complexity and no good, I can drop it. Your changelog doesn't really explain the motivation. Does the change help performance? Is this a pure cleanup? 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. 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. -- Michal Hocko SUSE Labs