Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1586105
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there |
| Date | 2017-02-22 12:50 +0100 |
| Message-ID | <tdDAK-13e-29@gated-at.bofh.it> (permalink) |
| References | <tdB5U-7N5-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed 22-02-17 17:04:48, Jia He wrote:
> When I try to dynamically allocate the hugepages more than system total
> free memory:
> e.g. echo 4000 >/proc/sys/vm/nr_hugepages
I assume that the command has terminated with less huge pages allocated
than requested but
> Node 3, zone DMA
[...]
> pages free 2951
> min 2821
> low 3526
> high 4231
it left the zone below high watermark with
> node_scanned 0
> spanned 245760
> present 245760
> managed 245388
> nr_free_pages 2951
> nr_zone_inactive_anon 0
> nr_zone_active_anon 0
> nr_zone_inactive_file 0
> nr_zone_active_file 0
no pages reclaimable, so kswapd will not go to sleep. It would be quite
easy and comfortable to call it a misconfiguration but it seems that
it might be quite easy to hit with NUMA machines which have large
differences in the node sizes. I guess it makes sense to back off
the kswapd rather than burning CPU without any way to make forward
progress.
[...]
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 532a2a7..a05e3ab 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -3139,7 +3139,8 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, int classzone_idx)
> if (!managed_zone(zone))
> continue;
>
> - if (!zone_balanced(zone, order, classzone_idx))
> + if (!zone_balanced(zone, order, classzone_idx)
> + && zone_reclaimable_pages(zone))
> return false;
OK, this makes some sense, although zone_reclaimable_pages doesn't count
SLAB reclaimable pages. So we might go to sleep with a reclaimable slab
still around. This is not really easy to address because the reclaimable
slab doesn't really imply that those pages will be reclaimed...
> }
>
> @@ -3502,6 +3503,7 @@ void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx)
> {
> pg_data_t *pgdat;
> int z;
> + int node_has_relaimable_pages = 0;
>
> if (!managed_zone(zone))
> return;
> @@ -3522,8 +3524,15 @@ void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx)
>
> if (zone_balanced(zone, order, classzone_idx))
> return;
> +
> + if (!zone_reclaimable_pages(zone))
> + node_has_relaimable_pages = 1;
What, this doesn't make any sense? Did you mean if (zone_reclaimable_pages)?
> }
>
> + /* Dont wake kswapd if no reclaimable pages */
> + if (!node_has_relaimable_pages)
> + return;
> +
> trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order);
> wake_up_interruptible(&pgdat->kswapd_wait);
> }
> --
> 1.8.5.6
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Jia He <hejianet@gmail.com> - 2017-02-22 10:10 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-22 12:50 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there hejianet <hejianet@gmail.com> - 2017-02-22 15:40 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-22 16:50 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there hejianet <hejianet@gmail.com> - 2017-02-23 03:30 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Johannes Weiner <hannes@cmpxchg.org> - 2017-02-22 21:30 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Johannes Weiner <hannes@cmpxchg.org> - 2017-02-22 22:00 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-23 08:30 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-23 08:30 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-23 11:30 +0100
Re: [RFC PATCH] mm/vmscan: fix high cpu usage of kswapd if there Michal Hocko <mhocko@kernel.org> - 2017-02-23 12:20 +0100
csiph-web