From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: josef@toxicpanda.com
Cc: minchan@kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org,
riel@redhat.com, akpm@linux-foundation.org, david@fromorbit.com,
kernel-team@fb.com, Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH 2/2][RESEND] mm: make kswapd try harder to keep active pages in cache
Date: Tue, 22 Aug 2017 18:38:01 +0300 [thread overview]
Message-ID: <ac46d1df-7a5c-1a36-cf5e-cede3069f4cd@virtuozzo.com> (raw)
In-Reply-To: <1503066528-1833-2-git-send-email-jbacik@fb.com>
On 08/18/2017 05:28 PM, josef@toxicpanda.com wrote:
> @@ -3552,6 +3672,7 @@ static int kswapd(void *p)
> pgdat->kswapd_order = 0;
> pgdat->kswapd_classzone_idx = MAX_NR_ZONES;
> for ( ; ; ) {
> + unsigned long slab_diff, inactive_diff;
> bool ret;
>
> alloc_order = reclaim_order = pgdat->kswapd_order;
> @@ -3579,6 +3700,23 @@ static int kswapd(void *p)
> continue;
>
> /*
> + * We want to know where we're adding pages so we can make
> + * smarter decisions about where we're going to put pressure
> + * when shrinking.
> + */
> + slab_diff = sum_zone_node_page_state(pgdat->node_id,
> + NR_SLAB_RECLAIMABLE);
This should be node_page_state().
sum_zone_node_page_state() counts sum of zone_stat_item counter across node, but
NR_SLAB_RECLAIMABLE is node_stat_item counter. So in fact you'll get NR_ZONE_UNEVICTABLE here,
(since value of NR_ZONE_UNEVICTABLE equals to NR_SLAB_RECLAIMABLE).
> + inactive_diff = node_page_state(pgdat, NR_INACTIVE_FILE);
> + if (nr_slab > slab_diff)
> + slab_diff = 0;
> + else
> + slab_diff -= nr_slab;
> + if (inactive_diff < nr_inactive)
> + inactive_diff = 0;
> + else
> + inactive_diff -= nr_inactive;
> +
> + /*
> * Reclaim begins at the requested order but if a high-order
> * reclaim fails then kswapd falls back to reclaiming for
> * order-0. If that happens, kswapd will consider sleeping
> @@ -3588,7 +3726,11 @@ static int kswapd(void *p)
> */
> trace_mm_vmscan_kswapd_wake(pgdat->node_id, classzone_idx,
> alloc_order);
> - reclaim_order = balance_pgdat(pgdat, alloc_order, classzone_idx);
> + reclaim_order = balance_pgdat(pgdat, alloc_order, classzone_idx,
> + inactive_diff, slab_diff);
> + nr_inactive = node_page_state(pgdat, NR_INACTIVE_FILE);
> + nr_slab = sum_zone_node_page_state(pgdat->node_id,
> + NR_SLAB_RECLAIMABLE);
ditto.
> if (reclaim_order < alloc_order)
> goto kswapd_try_sleep;
> }
> @@ -3840,6 +3982,8 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
> .may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP),
> .may_swap = 1,
> .reclaim_idx = gfp_zone(gfp_mask),
> + .slab_diff = 1,
> + .inactive_diff = 1,
The only place where __node_reclaim() may use these fields is in the shrink_node():
if (nr_inactive > total_high_wmark &&
sc->inactive_diff > sc->slab_diff) {
Obviously 1 vs 0 doesn't make any difference here. This makes we wonder, why are these fields initialized to 1?
> };
>
> cond_resched();
>
--
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>
prev parent reply other threads:[~2017-08-22 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 14:28 [PATCH 1/2][RESEND] mm: use sc->priority for slab shrink targets josef
2017-08-18 14:28 ` [PATCH 2/2][RESEND] mm: make kswapd try harder to keep active pages in cache josef
2017-08-22 15:38 ` Andrey Ryabinin [this message]
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=ac46d1df-7a5c-1a36-cf5e-cede3069f4cd@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=hannes@cmpxchg.org \
--cc=jbacik@fb.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
/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