From: Waiman Long <longman@redhat.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
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>, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH] mm/vmstat: Reduce zone lock hold time when reading /proc/pagetypeinfo
Date: Tue, 22 Oct 2019 14:40:04 -0400 [thread overview]
Message-ID: <e272f2e0-153d-4194-f2d6-a15610be4dce@redhat.com> (raw)
In-Reply-To: <0b206255-5c62-18f5-d751-a5576a6c0e8f@redhat.com>
On 10/22/19 2:00 PM, Waiman Long wrote:
> On 10/22/19 12:57 PM, Michal Hocko wrote:
>
>>> and used nr_free to compute the missing count. Since MIGRATE_MOVABLE
>>> is usually the largest one on large memory systems, this is the one
>>> to be skipped. Since the printing order is migration-type => order, we
>>> will have to store the counts in an internal 2D array before printing
>>> them out.
>>>
>>> Even by skipping the MIGRATE_MOVABLE pages, we may still be holding the
>>> zone lock for too long blocking out other zone lock waiters from being
>>> run. This can be problematic for systems with large amount of memory.
>>> So a check is added to temporarily release the lock and reschedule if
>>> more than 64k of list entries have been iterated for each order. With
>>> a MAX_ORDER of 11, the worst case will be iterating about 700k of list
>>> entries before releasing the lock.
>> But you are still iterating through the whole free_list at once so if it
>> gets really large then this is still possible. I think it would be
>> preferable to use per migratetype nr_free if it doesn't cause any
>> regressions.
>>
> Yes, it is still theoretically possible. I will take a further look at
> having per-migrate type nr_free. BTW, there is one more place where the
> free lists are being iterated with zone lock held - mark_free_pages().
Looking deeper into the code, the exact migration type is not stored in
the page itself. An initial movable page can be stolen to be put into
another migration type. So in a delete or move from free_area, we don't
know exactly what migration type the page is coming from. IOW, it is
hard to get accurate counts of the number of entries in each lists.
I am not saying this is impossible, but doing it may require stealing
some bits from the page structure to store this information which is
probably not worth the benefit we can get from it. So if you have any
good suggestion of how to do it without too much cost, please let me
know about it. Otherwise, I will probably stay with the current patch.
Cheers,
Longman
next prev parent reply other threads:[~2019-10-22 18:40 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 16:21 [PATCH] mm/vmstat: Reduce zone lock hold time when reading /proc/pagetypeinfo Waiman Long
2019-10-22 16:57 ` Michal Hocko
2019-10-22 18:00 ` Waiman Long
2019-10-22 18:40 ` Waiman Long [this message]
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 ` [RFC PATCH 0/2] " Michal Hocko
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=e272f2e0-153d-4194-f2d6-a15610be4dce@redhat.com \
--to=longman@redhat.com \
--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=mgorman@suse.de \
--cc=mhocko@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).