From: Johannes Weiner <hannes@cmpxchg.org>
To: Josef Bacik <josef@toxicpanda.com>
Cc: Jan Kara <jack@suse.cz>,
linux-mm@kvack.org, akpm@linux-foundation.org,
linux-fsdevel@vger.kernel.org, kernel-team@fb.com,
linux-btrfs@vger.kernel.org, Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH v2 06/11] writeback: add counters for metadata usage
Date: Wed, 6 Dec 2017 17:43:42 -0500 [thread overview]
Message-ID: <20171206224342.GA4547@cmpxchg.org> (raw)
In-Reply-To: <20171206201833.trvfyz4pldetr2cv@destiny>
On Wed, Dec 06, 2017 at 03:18:35PM -0500, Josef Bacik wrote:
> On Mon, Dec 04, 2017 at 02:06:30PM +0100, Jan Kara wrote:
> > On Wed 22-11-17 16:16:01, Josef Bacik wrote:
> > > diff --git a/mm/util.c b/mm/util.c
> > > index 34e57fae959d..681d62631ee0 100644
> > > --- a/mm/util.c
> > > +++ b/mm/util.c
> > > @@ -616,6 +616,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
> > > if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) {
> > > free = global_zone_page_state(NR_FREE_PAGES);
> > > free += global_node_page_state(NR_FILE_PAGES);
> > > + free += global_node_page_state(NR_METADATA_BYTES) >> PAGE_SHIFT;
> >
> >
> > I'm not really sure this is OK. It depends on whether mm is really able to
> > reclaim these pages easily enough... Summon mm people for help :)
> >
>
> Well we count NR_SLAB_RECLAIMABLE here, so it's no different than that. The
> point is that it's theoretically reclaimable, and we should at least try.
I agree with including metadata in the equation. The (somewhat dusty)
overcommit code is mostly for containing swap storms, which is why it
adds up all the reclaimable pools that aren't backed by swap. The
metadata pool belongs in that category.
> > > @@ -3812,6 +3813,7 @@ static inline unsigned long node_unmapped_file_pages(struct pglist_data *pgdat)
> > > static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat)
> > > {
> > > unsigned long nr_pagecache_reclaimable;
> > > + unsigned long nr_metadata_reclaimable;
> > > unsigned long delta = 0;
> > >
> > > /*
> > > @@ -3833,7 +3835,20 @@ static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat)
> > > if (unlikely(delta > nr_pagecache_reclaimable))
> > > delta = nr_pagecache_reclaimable;
> > >
> > > - return nr_pagecache_reclaimable - delta;
> > > + nr_metadata_reclaimable =
> > > + node_page_state(pgdat, NR_METADATA_BYTES) >> PAGE_SHIFT;
> > > + /*
> > > + * We don't do writeout through the shrinkers so subtract any
> > > + * dirty/writeback metadata bytes from the reclaimable count.
> > > + */
> > > + if (nr_metadata_reclaimable) {
> > > + unsigned long unreclaimable =
> > > + node_page_state(pgdat, NR_METADATA_DIRTY_BYTES) +
> > > + node_page_state(pgdat, NR_METADATA_WRITEBACK_BYTES);
> > > + unreclaimable >>= PAGE_SHIFT;
> > > + nr_metadata_reclaimable -= unreclaimable;
> > > + }
> > > + return nr_metadata_reclaimable + nr_pagecache_reclaimable - delta;
> > > }
> >
> > Ditto as with __vm_enough_memory(). In particular I'm unsure whether the
> > watermarks like min_unmapped_pages or min_slab_pages would still work as
> > designed.
> >
>
> Yeah agreed I'd like an MM person's thoughts on this as well. We don't count
> SLAB_RECLAIMABLE here, but that's because it's just not related to pagecache. I
> guess it only matters for node reclaim and we have our node reclaim stuff turned
> off, which means it doesn't help us anyway, so I'm happy to just drop it and let
> somebody who cares about node reclaim think about it later ;). Thanks,
Few people care about node reclaim at this point, see 4f9b16a64753
("mm: disable zone_reclaim_mode by default"), and it's honestly a bit
baffling why we made min_slab_ratio a tunable in the first place. Who
knows how/if anybody relies on that behavior. I'd just leave it alone.
next prev parent reply other threads:[~2017-12-06 22:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 21:15 [PATCH v2 00/11] Metadata specific accouting and dirty writeout Josef Bacik
2017-11-22 21:15 ` [PATCH v2 01/11] remove mapping from balance_dirty_pages*() Josef Bacik
2017-11-22 21:15 ` [PATCH v2 02/11] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes Josef Bacik
2017-11-29 17:02 ` Jan Kara
2017-11-22 21:15 ` [PATCH v2 03/11] lib: make the fprop batch size a multiple of PAGE_SIZE Josef Bacik
2017-11-29 17:04 ` Jan Kara
2017-11-30 15:48 ` David Sterba
2017-11-22 21:15 ` [PATCH v2 04/11] lib: add a __fprop_add_percpu_max Josef Bacik
2017-11-29 17:05 ` Jan Kara
2017-11-22 21:16 ` [PATCH v2 05/11] writeback: convert the flexible prop stuff to bytes Josef Bacik
2017-11-29 17:05 ` Jan Kara
2017-11-22 21:16 ` [PATCH v2 06/11] writeback: add counters for metadata usage Josef Bacik
2017-12-04 13:06 ` Jan Kara
2017-12-06 20:18 ` Josef Bacik
2017-12-06 22:43 ` Johannes Weiner [this message]
2017-11-22 21:16 ` [PATCH v2 07/11] writeback: introduce super_operations->write_metadata Josef Bacik
2017-11-22 21:16 ` [PATCH v2 08/11] export radix_tree_iter_tag_set Josef Bacik
2017-11-22 21:16 ` [PATCH v2 09/11] Btrfs: kill the btree_inode Josef Bacik
2017-11-27 17:10 ` David Sterba
2017-11-22 21:16 ` [PATCH v2 10/11] btrfs: rework end io for extent buffer reads Josef Bacik
2017-11-22 21:16 ` [PATCH v2 11/11] btrfs: add NR_METADATA_BYTES accounting Josef Bacik
2017-11-23 18:45 ` [PATCH v2 00/11] Metadata specific accouting and dirty writeout David Sterba
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=20171206224342.GA4547@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=jbacik@fb.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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).