From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7FEBC4338F for ; Sun, 15 Aug 2021 15:31:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 445E86109F for ; Sun, 15 Aug 2021 15:31:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 445E86109F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 81D898D0001; Sun, 15 Aug 2021 11:31:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CE206B0072; Sun, 15 Aug 2021 11:31:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E34A8D0001; Sun, 15 Aug 2021 11:31:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 528D86B0071 for ; Sun, 15 Aug 2021 11:31:18 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F3371180ACF14 for ; Sun, 15 Aug 2021 15:31:17 +0000 (UTC) X-FDA: 78477703794.05.AFE917D Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 50AD7F000EE0 for ; Sun, 15 Aug 2021 15:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BqtZWyHni8kDbNBmf64slxfsIzFkikJ2OnJFjbTuna0=; b=Ga8dm3CR4BjqMKW8kRCtDnhubs j5ghsILEkYuURH62d+47K5M/te9L9fz/CRdIKFEKEITjyxHwwgIa5OW4g0k+gTHRCSmtt0lizVEQP DLP69r6KUQA4IXgHdeSv9u182WlA352C5JM68gKn84lFmuctxdGHV/fDiQF6DJQfGIDrZwlXRkiOX yQoLfV+kVv497QkVbphHZBTUJFf8dkSdS811vGE+eomz2rGaDZLX/gq3Rio+LaLp25KjwdqGQZR8l iWXYaHo7bHXJEPKX/ceeOqRntknxxu69kwuUyTVX8AhnI993qWB+ti0RIKjU4tOdvCIZ5OG9A3quV ONWt7kCg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFI65-000Nwd-Ff; Sun, 15 Aug 2021 15:30:55 +0000 Date: Sun, 15 Aug 2021 16:30:49 +0100 From: Matthew Wilcox To: Mianhan Liu Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Eric Dumazet Subject: Re: [PATCH -next v2] include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h Message-ID: References: <20210815115057.1511-1-liumh1@shanghaitech.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210815115057.1511-1-liumh1@shanghaitech.edu.cn> X-Rspamd-Queue-Id: 50AD7F000EE0 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ga8dm3CR; dmarc=none; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam04 X-Stat-Signature: j1eq39ffq6ddi3rap8wcgboz7hpw1p7o X-HE-Tag: 1629041477-646274 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Aug 15, 2021 at 07:50:57PM +0800, Mianhan Liu wrote: > nr_free_buffer_pages could be exposed through mm.h instead of swap.h. > The advantage of this change is that it can reduce the obsolete includes. > For example, net/ipv4/tcp.c wouldn't need swap.h any more since it has > already included mm.h. > Moreover, after preprocessing all the files that use nr_free_buffer_pages, > it turns out that those files have already included mm.h. > Thus, we can move nr_free_buffer_pages from swap.h to mm.h safely. This change > will not affect the compilation of other files. In general, we're trying to move in the other direction; move things out of mm.h and reduce the number of files which include mm.h. That said, I don't see what nr_free_buffer_pages() has to do with the rest of swap.h, so I'm OK with moving this over. That said, there are a number of other files which should have swap.h removed. eg: drivers/mmc/core/mmc_test.c:#include /* For nr_free_buffer_pages() */ and it would be good to check the other files which use nr_free_buffer_pages() to see if they can have swap.h removed too. > +++ b/include/linux/mm.h > @@ -871,6 +871,7 @@ void put_pages_list(struct list_head *pages); > void split_page(struct page *page, unsigned int order); > void folio_copy(struct folio *dst, struct folio *src); > > +extern unsigned long nr_free_buffer_pages(void); Please remove the 'extern' while you're moving this. > +++ b/net/ipv4/tcp.c If you're interested in cleaning up the headers, it'd be nice if less of the networking code depended on pagemap.h ...