Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1276420
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] mm, vmscan: do not overestimate anonymous reclaimable pages |
| Date | 2015-11-24 14:10 +0100 |
| Message-ID | <qylw7-5A-29@gated-at.bofh.it> (permalink) |
| References | <qykql-7Cj-1@gated-at.bofh.it> <qykql-7Cj-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Nov 24, 2015 at 12:55:00PM +0100, Michal Hocko wrote:
> zone_reclaimable_pages considers all anonymous pages on LRUs reclaimable
> if there is at least one entry on the swap storage left. This can be
> really misleading when the swap is short on space and skew reclaim
> decisions based on zone_reclaimable_pages. Fix this by clamping the
> number to the minimum of the available swap space and anon LRU pages.
Suppose there's 100M of swap and 1G of anon pages. This patch makes
zone_reclaimable_pages return 100M instead of 1G in this case. If you
rotate 600M of oldest anon pages, which is quite possible,
zone_reclaimable will start returning false, which is wrong, because
there are still 400M pages that were not even scanned, besides those
600M of rotated pages could have become reclaimable after their ref bits
got cleared.
I think it is the name of zone_reclaimable_pages which is misleading. It
should be called something like "zone_scannable_pages" judging by how it
is used in zone_reclaimable.
Thanks,
Vladimir
>
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/vmscan.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 946d348f5040..646001a1f279 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -195,15 +195,20 @@ static bool sane_reclaim(struct scan_control *sc)
> static unsigned long zone_reclaimable_pages(struct zone *zone)
> {
> unsigned long nr;
> + long nr_swap = get_nr_swap_pages();
>
> nr = zone_page_state(zone, NR_ACTIVE_FILE) +
> zone_page_state(zone, NR_INACTIVE_FILE) +
> zone_page_state(zone, NR_ISOLATED_FILE);
>
> - if (get_nr_swap_pages() > 0)
> - nr += zone_page_state(zone, NR_ACTIVE_ANON) +
> - zone_page_state(zone, NR_INACTIVE_ANON) +
> - zone_page_state(zone, NR_ISOLATED_ANON);
> + if (nr_swap > 0) {
> + unsigned long anon;
> +
> + anon = zone_page_state(zone, NR_ACTIVE_ANON) +
> + zone_page_state(zone, NR_INACTIVE_ANON) +
> + zone_page_state(zone, NR_ISOLATED_ANON);
> + nr += min_t(unsigned long, nr_swap, anon);
> + }
>
> return nr;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] 2 zone_pages_reclaimable fixes Michal Hocko <mhocko@kernel.org> - 2015-11-24 13:00 +0100
[PATCH 2/2] mm, vmscan: do not overestimate anonymous reclaimable pages Michal Hocko <mhocko@kernel.org> - 2015-11-24 13:00 +0100
Re: [PATCH 2/2] mm, vmscan: do not overestimate anonymous reclaimable pages Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-24 14:10 +0100
Re: [PATCH 2/2] mm, vmscan: do not overestimate anonymous reclaimable pages Michal Hocko <mhocko@kernel.org> - 2015-11-24 14:40 +0100
[PATCH 1/2] mm, vmscan: consider isolated pages in zone_reclaimable_pages Michal Hocko <mhocko@kernel.org> - 2015-11-24 13:00 +0100
Re: [PATCH 1/2] mm, vmscan: consider isolated pages in zone_reclaimable_pages Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-24 15:00 +0100
Re: [PATCH 1/2] mm, vmscan: consider isolated pages in zone_reclaimable_pages Johannes Weiner <hannes@cmpxchg.org> - 2015-11-24 17:10 +0100
Re: [PATCH 1/2] mm, vmscan: consider isolated pages in zone_reclaimable_pages David Rientjes <rientjes@google.com> - 2015-11-25 12:10 +0100
csiph-web