From: Andrew Morton <akpm@linux-foundation.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: broonie@kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-next@vger.kernel.org, mhocko@suse.cz,
mm-commits@vger.kernel.org, sfr@canb.auug.org.au,
Shakeel Butt <shakeelb@google.com>
Subject: Re: mmotm 2021-01-12-01-57 uploaded (NR_SWAPCACHE in mm/)
Date: Tue, 12 Jan 2021 13:50:10 -0800 [thread overview]
Message-ID: <20210112135010.267508efa85fe98f670ed9e9@linux-foundation.org> (raw)
In-Reply-To: <ac517aa0-2396-321c-3396-13aafba46116@infradead.org>
On Tue, 12 Jan 2021 12:38:18 -0800 Randy Dunlap <rdunlap@infradead.org> wrote:
> On 1/12/21 1:58 AM, akpm@linux-foundation.org wrote:
> > The mm-of-the-moment snapshot 2021-01-12-01-57 has been uploaded to
> >
> > https://www.ozlabs.org/~akpm/mmotm/
> >
> > mmotm-readme.txt says
> >
> > README for mm-of-the-moment:
> >
> > https://www.ozlabs.org/~akpm/mmotm/
> >
> > This is a snapshot of my -mm patch queue. Uploaded at random hopefully
> > more than once a week.
> >
>
> on i386 and x86_64:
>
> when CONFIG_SWAP is not set/enabled:
>
> ../mm/migrate.c: In function ‘migrate_page_move_mapping’:
> ../mm/migrate.c:504:35: error: ‘NR_SWAPCACHE’ undeclared (first use in this function); did you mean ‘QC_SPACE’?
> __mod_lruvec_state(old_lruvec, NR_SWAPCACHE, -nr);
> ^~~~~~~~~~~~
>
> ../mm/memcontrol.c:1529:20: error: ‘NR_SWAPCACHE’ undeclared here (not in a function); did you mean ‘SGP_CACHE’?
> { "swapcached", NR_SWAPCACHE },
> ^~~~~~~~~~~~
Thanks. I did the below.
But we're still emitting "Node %d SwapCached: 0 kB" in sysfs when
CONFIG_SWAP=n, which is probably wrong. Shakeel, can you please have a
think?
--- a/mm/memcontrol.c~mm-memcg-add-swapcache-stat-for-memcg-v2-fix
+++ a/mm/memcontrol.c
@@ -1521,7 +1521,9 @@ static const struct memory_stat memory_s
{ "file_mapped", NR_FILE_MAPPED },
{ "file_dirty", NR_FILE_DIRTY },
{ "file_writeback", NR_WRITEBACK },
+#ifdef CONFIG_SWAP
{ "swapcached", NR_SWAPCACHE },
+#endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
{ "anon_thp", NR_ANON_THPS },
{ "file_thp", NR_FILE_THPS },
--- a/mm/migrate.c~mm-memcg-add-swapcache-stat-for-memcg-v2-fix
+++ a/mm/migrate.c
@@ -500,10 +500,12 @@ int migrate_page_move_mapping(struct add
__mod_lruvec_state(old_lruvec, NR_SHMEM, -nr);
__mod_lruvec_state(new_lruvec, NR_SHMEM, nr);
}
+#ifdef CONFIG_SWAP
if (PageSwapCache(page)) {
__mod_lruvec_state(old_lruvec, NR_SWAPCACHE, -nr);
__mod_lruvec_state(new_lruvec, NR_SWAPCACHE, nr);
}
+#endif
if (dirty && mapping_can_writeback(mapping)) {
__mod_lruvec_state(old_lruvec, NR_FILE_DIRTY, -nr);
__mod_zone_page_state(oldzone, NR_ZONE_WRITE_PENDING, -nr);
_
next prev parent reply other threads:[~2021-01-12 21:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 9:58 mmotm 2021-01-12-01-57 uploaded akpm
2021-01-12 20:38 ` mmotm 2021-01-12-01-57 uploaded (NR_SWAPCACHE in mm/) Randy Dunlap
2021-01-12 21:50 ` Andrew Morton [this message]
2021-01-12 21:59 ` Shakeel Butt
2021-01-12 22:20 ` Randy Dunlap
2021-01-13 3:31 ` Stephen Rothwell
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=20210112135010.267508efa85fe98f670ed9e9@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=mhocko@suse.cz \
--cc=mm-commits@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=shakeelb@google.com \
/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).