linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Mianhan Liu <liumh1@shanghaitech.edu.cn>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH -next v2] include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h
Date: Sun, 15 Aug 2021 16:30:49 +0100	[thread overview]
Message-ID: <YRkzKZ7yvKlCehR9@casper.infradead.org> (raw)
In-Reply-To: <20210815115057.1511-1-liumh1@shanghaitech.edu.cn>

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 <linux/swap.h>             /* 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 ...

      reply	other threads:[~2021-08-15 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 11:50 [PATCH -next v2] include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h Mianhan Liu
2021-08-15 15:30 ` Matthew Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRkzKZ7yvKlCehR9@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liumh1@shanghaitech.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).