Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4681831ybv; Wed, 26 Feb 2020 01:14:54 -0800 (PST) X-Google-Smtp-Source: APXvYqy71t3u8/48GOhjc1oJYnqmQLXZVgNUWzoo6wQJeoUQH4hwzSxeooJPH0wTUOoKq7ylQPU0 X-Received: by 2002:a05:6808:b1c:: with SMTP id s28mr2316390oij.2.1582708493780; Wed, 26 Feb 2020 01:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582708493; cv=none; d=google.com; s=arc-20160816; b=fL6OjI8GzE+L8henMrzjxN3JHF/K4cGzLsZh+HbqBhs+bBrwKlFHTdaTeF8KIQonXb H7XLPo7DkGWQjKKM6I6dRyI+WwoIVhHLtwNg5BObZZOEMMD1Z7Gw4dKNjjgggz75Sf+h P4icr0gtkx0k/DPIky6sPUizHHAJ0hmjTaP06x9fnjMFejkrJ9XsNNhVYM7D99k4/+2t aWAHl3i2jsh2O92iQM0a3eDB5UogBt3eixjsLAJCQp8PtQeo1Sbq1vCtLsW/QVnu13Qi r2rVGQUBlSUd+9rNTwabnuCKzxb/aSq+gvQRB7c0BWnv1Xs1jnj34r8m5K6i76xE5IlG 5Lcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=90Gaup4GBl/WZhK+7p3+YI0kruzLG0IEp7O26cMJO1E=; b=AXi+ZhLH8cpOC1/Xx7/dtDivnQkUJ3rg9LUtM4qWuHu5yOg0igCM/+pfDPhrEETR8+ XuDLbqSBHbe7lIHfQjVYQqavQg1tahSy0pXq3ODsErrlHWPYgADuRvKYYAGx7QpNPntt ItpQ1l31UbvT3m3GB3Ne959DoAnaNJXnhBT+7Bm7XwhowwMvAMUv+f27D7LdytEIeXYR zpVFmFiWtc1abCEG2GS6lVgpnIcm2gsqDC/EJCRDtvFvZ7Y7qdFBhQNyYsPnbBFmlTDz 2hbR5/N1pchZqxmFtNCmB2L9/d0ADiX6No8v60GUNhtHVfsc5tlMaGFebOA63SG6evuh Wbwg== 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 z23si925670oti.34.2020.02.26.01.14.41; Wed, 26 Feb 2020 01:14:53 -0800 (PST) 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 S1727311AbgBZJOY (ORCPT + 99 others); Wed, 26 Feb 2020 04:14:24 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34047 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbgBZJOY (ORCPT ); Wed, 26 Feb 2020 04:14:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id z15so2019280wrl.1 for ; Wed, 26 Feb 2020 01:14:23 -0800 (PST) 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; bh=90Gaup4GBl/WZhK+7p3+YI0kruzLG0IEp7O26cMJO1E=; b=OjjG5NdjjvXoXxveLrFLJgIAF8XcsBwYf/hyD9u3TR4xM0MB+6wHciuWyOu7N4fklx hPU6Lf74lqeNBCNP/YCfwNrm3CD7mU+LJLlKjdID+dVWWD7SV2/mlF3yEhUuGrA9nH3G RzEYCEXab0NSzdbuSRcLcn4F7Z2EaLrgJgbjE+C3Kc7+GxcXkl0PbuTYlFyDNuN47+Io ow/OgMxHaMQBdUDWD3WVA6gwIKLNwLK5trjYRoHkP5KK6gtAOJToKODhQXsrglcJSQcH RzE+ujJF829XIiHmp4Q6UhjpATYUo+ngPMkuNL/Shrv8GCMEVM6DOx2sCL0EzcJblkeD aVDw== X-Gm-Message-State: APjAAAXcNdfWff/0axflgE6iZDnghLJZ2o7qkEz2fhAW/wp9BEnx8QEf aIaqFpvOQQxWHLJzYHJcgNk= X-Received: by 2002:adf:ecc2:: with SMTP id s2mr4382833wro.263.1582708462718; Wed, 26 Feb 2020 01:14:22 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id o15sm2430534wra.83.2020.02.26.01.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 01:14:22 -0800 (PST) Date: Wed, 26 Feb 2020 10:14:21 +0100 From: Michal Hocko To: Baoquan He Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, richardw.yang@linux.intel.com, osalvador@suse.de, dan.j.williams@intel.com, rppt@linux.ibm.com, robin.murphy@arm.com Subject: Re: [PATCH v2 0/7] mm/hotplug: Only use subsection map in VMEMMAP case Message-ID: <20200226091421.GE3771@dhcp22.suse.cz> References: <20200220043316.19668-1-bhe@redhat.com> <20200220103849.GG20509@dhcp22.suse.cz> <20200221142847.GG4937@MiWiFi-R3L-srv> <75b4f840-7454-d6d0-5453-f0a045c852fa@redhat.com> <20200225100226.GM22443@dhcp22.suse.cz> <20200226034236.GD24216@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200226034236.GD24216@MiWiFi-R3L-srv> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 26-02-20 11:42:36, Baoquan He wrote: > On 02/25/20 at 11:02am, Michal Hocko wrote: > > On Tue 25-02-20 10:10:45, David Hildenbrand wrote: > > > >>> include/linux/mmzone.h | 2 + > > > >>> mm/sparse.c | 178 +++++++++++++++++++++++++++++------------ > > > >>> 2 files changed, 127 insertions(+), 53 deletions(-) > > > >> > > > >> Why do we need to add so much code to remove a functionality from one > > > >> memory model? > > > > > > > > Hmm, Dan also asked this before. > > > > > > > > The adding mainly happens in patch 2, 3, 4, including the two newly > > > > added function defitions, the code comments above them, and those added > > > > dummy functions for !VMEMMAP. > > > > > > AFAIKS, it's mostly a bunch of newly added comments on top of functions. > > > E.g., the comment for fill_subsection_map() alone spans 12 LOC in total. > > > I do wonder if we have to be that verbose. We are barely that verbose on > > > MM code (and usually I don't see much benefit unless it's a function > > > with many users from many different places). > > > > I would tend to agree here. Not that I am against kernel doc > > documentation but these are internal functions and the comment doesn't > > really give any better insight IMHO. I would be much more inclined if > > this was the general pattern in the respective file but it just stands > > out. > > I saw there are internal functions which have code comments, e.g > shrink_slab() in mm/vmscan.c, not only this one place, there are several > places. I personally prefer to see code comment for function if > possible, this can save time, e.g people can skip the bitmap operation > when read code if not necessary. And here I mainly want to tell there > are different returned value to note different behaviour when call them. ... yet nobody really cares about different return code. It is an error that is propagated up the call chain and that's all. I also like when there is a kernel doc comment that helps to understand the intented usage, context the function can be called from, potential side effects, locking requirements and other details people need to know when calling functions. But have a look at /** * clear_subsection_map - Clear subsection map of one memory region * * @pfn - start pfn of the memory range * @nr_pages - number of pfns to add in the region * * This is only intended for hotplug, and clear the related subsection * map inside one section. * * Return: * * -EINVAL - Section already deactived. * * 0 - Subsection map is emptied. * * 1 - Subsection map is not empty. */ the only useful information in here is that this is a hotplug stuff but I would be completely lost about the intention without already knowing what is this whole subsection about. -- Michal Hocko SUSE Labs