From: Michal Hocko <mhocko@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@suse.de>, Waiman Long <longman@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <guro@fb.com>, Vlastimil Babka <vbabka@suse.cz>,
Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
Jann Horn <jannh@google.com>, Song Liu <songliubraving@fb.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rafael Aquini <aquini@redhat.com>, <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 0/2] mm/vmstat: Reduce zone lock hold time when reading /proc/pagetypeinfo
Date: Wed, 23 Oct 2019 12:27:35 +0200 [thread overview]
Message-ID: <20191023102737.32274-1-mhocko@kernel.org> (raw)
In-Reply-To: <20191023095607.GE3016@techsingularity.net>
On Wed 23-10-19 10:56:08, Mel Gorman wrote:
> On Wed, Oct 23, 2019 at 11:04:22AM +0200, Michal Hocko wrote:
> > So can we go with this to address the security aspect of this and have
> > something trivial to backport.
> >
>
> Yes.
Ok, patch 1 in reply to this email.
> > > > > There is a free_area structure associated with each page order. There
> > > > > is also a nr_free count within the free_area for all the different
> > > > > migration types combined. Tracking the number of free list entries
> > > > > for each migration type will probably add some overhead to the fast
> > > > > paths like moving pages from one migration type to another which may
> > > > > not be desirable.
> > > >
> > > > Have you tried to measure that overhead?
> > > >
> > >
> > > I would prefer this option not be taken. It would increase the cost of
> > > watermark calculations which is a relatively fast path.
> >
> > Is the change for the wmark check going to require more than
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index c0b2e0306720..5d95313ba4a5 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3448,9 +3448,6 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
> > struct free_area *area = &z->free_area[o];
> > int mt;
> >
> > - if (!area->nr_free)
> > - continue;
> > -
> > for (mt = 0; mt < MIGRATE_PCPTYPES; mt++) {
> > if (!free_area_empty(area, mt))
> > return true;
> >
> > Is this really going to be visible in practice? Sure we are going to do
> > more checks but most orders tend to have at least some memory in a
> > reasonably balanced system and we can hardly expect an optimal
> > allocation path on those that are not.
> >
>
> You also have to iterate over them all later in the same function. The the
> free counts are per migrate type then they would have to be iterated over
> every time.
>
> Similarly, there would be multiple places where all the counters would
> have to be iterated -- find_suitable_fallback, show_free_areas,
> fast_isolate_freepages, fill_contig_page_info, zone_init_free_lists etc.
>
> It'd be a small cost but given that it's aimed at fixing a problem with
> reading pagetypeinfo, is it really worth it? I don't think so.
Fair enough.
[...]
> > As pointed out in other email. The problem with this patch is that it
> > hasn't really removed the iteration over the whole free_list which is
> > the primary problem. So I think that we should either consider this a
> > non-issue and make it "admin knows this is potentially expensive" or do
> > something like Andrew was suggesting if we do not want to change the
> > nr_free accounting.
> >
>
> Again, the cost is when reading a proc file. From what Andrew said,
> the lock is necessary to safely walk the list but if anything. I would
> be ok with limiting the length of the walk but honestly, I would also
> be ok with simply deleting the proc file. The utility for debugging a
> problem with it is limited now (it was more important when fragmentation
> avoidance was first introduced) and there is little an admin can do with
> the information. I can't remember the last time I asked for the contents
> of the file when trying to debug a problem. There is a possibility that
> someone will complain but I'm not aware of any utility that reads the
> information and does something useful with it. In the unlikely event
> something breaks, the file can be re-added with a limited walk.
I went with a bound to the pages iteratred over in the free_list. See
patch 2.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2019-10-23 10:27 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 16:21 [PATCH] " Waiman Long
2019-10-22 16:57 ` Michal Hocko
2019-10-22 18:00 ` Waiman Long
2019-10-22 18:40 ` Waiman Long
2019-10-23 0:52 ` David Rientjes
2019-10-23 8:31 ` Mel Gorman
2019-10-23 9:04 ` Michal Hocko
2019-10-23 9:56 ` Mel Gorman
2019-10-23 10:27 ` Michal Hocko [this message]
2019-10-23 10:27 ` [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users Michal Hocko
2019-10-23 13:13 ` Mel Gorman
2019-10-23 13:27 ` Vlastimil Babka
2019-10-23 14:52 ` Waiman Long
2019-10-23 15:10 ` Rafael Aquini
2019-10-23 16:15 ` Vlastimil Babka
2019-10-24 19:01 ` David Rientjes
2019-10-23 10:27 ` [RFC PATCH 2/2] mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo Michal Hocko
2019-10-23 13:15 ` Mel Gorman
2019-10-23 13:32 ` Vlastimil Babka
2019-10-23 13:37 ` Michal Hocko
2019-10-23 13:48 ` Vlastimil Babka
2019-10-23 14:31 ` Michal Hocko
2019-10-23 16:20 ` Vlastimil Babka
2019-10-23 13:46 ` Rafael Aquini
2019-10-23 14:56 ` Waiman Long
2019-10-23 15:21 ` Waiman Long
2019-10-23 16:10 ` Michal Hocko
2019-10-23 16:17 ` Waiman Long
2019-10-23 16:21 ` Waiman Long
2019-10-23 16:15 ` Vlastimil Babka
2019-10-23 16:41 ` Michal Hocko
2019-10-23 16:47 ` Waiman Long
2019-10-23 17:34 ` [PATCH 1/2] mm, vmstat: Release zone lock more frequently when reading /proc/pagetypeinfo Waiman Long
2019-10-23 18:01 ` Michal Hocko
2019-10-23 18:14 ` Waiman Long
2019-10-23 20:02 ` Michal Hocko
2019-10-23 17:34 ` [PATCH 2/2] mm, vmstat: List total free blocks for each order in /proc/pagetypeinfo Waiman Long
2019-10-23 18:02 ` Michal Hocko
2019-10-23 18:07 ` Waiman Long
2019-10-24 8:20 ` [RFC PATCH 0/2] mm/vmstat: Reduce zone lock hold time when reading /proc/pagetypeinfo Michal Hocko
2019-10-24 16:16 ` Waiman Long
2019-10-23 12:42 ` [PATCH] " Qian Cai
2019-10-23 13:25 ` Vlastimil Babka
2019-10-22 21:59 ` Andrew Morton
2019-10-23 6:15 ` Michal Hocko
2019-10-23 14:30 ` Waiman Long
2019-10-23 14:48 ` Qian Cai
2019-10-23 15:01 ` Waiman Long
2019-10-23 15:05 ` Qian Cai
2019-10-23 22:30 ` Andrew Morton
2019-10-24 5:33 ` Qian Cai
2019-10-24 7:42 ` Michal Hocko
2019-10-24 11:11 ` Qian Cai
2019-10-24 13:38 ` Michal Hocko
2019-10-24 14:55 ` Qian Cai
2019-10-24 3:33 ` Feng Tang
2019-10-24 4:34 ` Qian Cai
2019-10-24 5:34 ` Feng Tang
2019-10-24 10:51 ` Qian Cai
2019-10-25 1:38 ` Feng Tang
2019-10-23 15:03 ` Rafael Aquini
2019-10-23 15:51 ` Qian Cai
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=20191023102737.32274-1-mhocko@kernel.org \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mgorman@suse.de \
--cc=songliubraving@fb.com \
--cc=vbabka@suse.cz \
/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