Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1301543pxf; Fri, 26 Mar 2021 05:29:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq/l8ubUnO9hXXjsdu1wfWaePceIF1zaeGtp3oezSAXGZf2m4SdFiWmUcyA9oHryUcIqD5 X-Received: by 2002:a05:6402:35d3:: with SMTP id z19mr14540666edc.143.1616761757381; Fri, 26 Mar 2021 05:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616761757; cv=none; d=google.com; s=arc-20160816; b=YTGlozO7k6LC77Ij7ZQbEN99TfLWy/YEtkgB2XVEfTFWIHx1VN7v93i4i16/SRiX/6 5qAUGrkhs0pXLQTqaXy+LUAbdd9PkoQ/KnCySeJkSVm3AUi5FKHcHrswIDa0qV3Q181I jGbhiFnSa7FdwBGtuvLwEdg9m061f7tZG3i9iLMXd8titwW7xBN/i+/sg0AYz/achJnc po2XG7fO7Z2MONhGEWfjT/cf1Cjg7MWrySE/NCzI0A3u/nZ/iGbBt7Hr8FNEkCYWEo18 b++9e2mQHmhPY+HHII3HXWkzjyKkIsRt/vHODu+CiYascN2s8g9DfwfoaP7Nu5FuuVX7 Og7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QxJHG67cnzAtp1qB+aYyj2WZtARO+XJmoqLkBw1fYTc=; b=ktl/fS4nV7SmXS7OWXW6g9+rg3mYcr9CCemgTqTiOmOm+g4fYWmS8kzEmt160RpP4U yz0AKaFnMzfY/MAmVEPSCeUP3+tg42HrLLzPHRenPokjF8vod/nqnj6U+sZTap4gveNc mxq8YDDbSDqApXOxm23Rqls0SVlymeoZzPTj3zGz/GRWQSv+C6moT9NcprvPJdYnwZsL 1RHy51nHFYUeFP3EGAeHxgtu9q0ep5ZbESFqT/zPiP+h49lzn3yW2WUzivklB80W14nW PnDVaXtDgp4EChiqFOozACs7GBbm1IQ7RKa1cbw00bQaEFPq8ub9awD01TPNDsEHFz1b vRHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="L4C7D/iP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si6001757edd.56.2021.03.26.05.28.54; Fri, 26 Mar 2021 05:29:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="L4C7D/iP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbhCZM16 (ORCPT + 99 others); Fri, 26 Mar 2021 08:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbhCZM1l (ORCPT ); Fri, 26 Mar 2021 08:27:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 175C0C0613AA; Fri, 26 Mar 2021 05:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=QxJHG67cnzAtp1qB+aYyj2WZtARO+XJmoqLkBw1fYTc=; b=L4C7D/iPJwNEbqcG8xy4WpMw5n BDecPJA0uQZuls/0/G6uBNfjaVsne8JK4g9DymhDULa+eE/btqy5hDts7uILquN4NfBruQ7m6EygX uWFIPixKNNiLamhYLsHw1z2qRKsswDbAFiY8guxFj1j7+XhVZ/+Ne3MKO0lrFlLhviJk0ieIkb5iw nTTZrkFH6Vb3euOOrFUWyGvV9L7lPH4LKeEy/tDHKU7wlaS6J37Ny5jh7srf6YMpq6M2SVKHchBie +F9XhvGqXqFXL+7/CYEpUX4V3YRUzD3SLO2iT79Z0cqJgDLw0j4ODKCeGop1vldaRMNCK4PGzPKGi IpW8DCOQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lPlYb-00En34-Ov; Fri, 26 Mar 2021 12:27:25 +0000 Date: Fri, 26 Mar 2021 12:27:17 +0000 From: Matthew Wilcox To: Qinglang Miao Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Hulk Robot Subject: Re: [PATCH -next] mm/page_alloc: remove duplicated include from page_alloc.c Message-ID: <20210326122717.GE1719932@casper.infradead.org> References: <20210326025542.3565329-1-miaoqinglang@huawei.com> <20210326034208.GC1719932@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 04:18:38PM +0800, Qinglang Miao wrote: > Hey, Matthew > > Thanks for your advice towards hulk robot. We'd like to improve the > capbility of hulk robot whole the time. > > This patch is just a small cleanup reported by hulk robot, But the robot can > do more than this. For example, it finds crucial and useful bugs as well. I'll have to take your word for it. Most of what I see from Hulk Robot is trivialities. > As for 'Untangle the mass of header includes' you mentioned, could you > please offer more details? Because I didn't find pagemap.h in net/ipv4/tcp.c > in -next like what you said. Exactly! But check net/ipv4/.tcp.o.d -- you'll see include/linux/pagemap.h in its dependencies. So it's being pulled in through another file that is included by tcp.c, either directly or indirectly. You can run a file through the preprocessor: $ make net/ipv4/tcp.i CPP net/ipv4/tcp.i and then look to see what included it: # 12 "../include/linux/swap.h" 2 # 1 "../include/linux/pagemap.h" 1 So the question then becomes _either_ "Does swap.h need pagemap.h?", _or_ "Does tcp.c need swap.h" So we can try both things, first deleting the include of pagemap.h from swap.h (compilation fails) and then deleting the include of swap.h from tcp.c (compilation also fails). This is a simple example because swap.h is included directly from tcp.c; the chain can be quite long. Some human intervention at this point might be possible. For example, nr_free_buffer_pages could be exposed through mm.h instead of swap.h, and then tcp.c wouldn't need swap.h. Or find_get_incore_page() could be moved from swap.h to pagemap.h and then swap.h wouldn't need pagemap.h. But then pagemap.h would acquire a dependency on CONFIG_SWAP (if it doesn't have that already). I don't think those are reasonable solutions for a bot to find. Or are they? Anyway, I'm sure there are a lot of obsolete includes. I have a patch sitting in my tree which removed pagemap.h from mempolicy.h. That causes a build failure in fs/aio.c, so the same patch adds pagemap.h to aio.c. It's not a particularly large win; only 5 files lose a dependency on pagemap.h, so I haven't decided what to do with it yet. > 在 2021/3/26 11:42, Matthew Wilcox 写道: > > On Fri, Mar 26, 2021 at 10:55:42AM +0800, Qinglang Miao wrote: > > > Remove duplicated include. > > > > > > Reported-by: Hulk Robot > > > Signed-off-by: Qinglang Miao > > > > can't you make hulk robot do something useful, like untangle the > > mass of header includes? For example, in -next, net/ipv4/tcp.c > > has a dependency on pagemap.h. Why? > > . > > >