linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>, Con Kolivas <kernel@kolivas.org>,
	linux-mm@kvack.org
Subject: Re: [patch] mm: adjust kswapd nice level for high priority page allocators
Date: Tue, 2 Mar 2010 13:29:19 +0900	[thread overview]
Message-ID: <28c262361003012029j1d17a0dch8987c0d6d939959e@mail.gmail.com> (raw)
In-Reply-To: <28c262361003010802o7de2a32ci913b3833074af9eb@mail.gmail.com>

On Tue, Mar 2, 2010 at 1:02 AM, Minchan Kim <minchan.kim@gmail.com> wrote:
> On Mon, Mar 1, 2010 at 7:14 PM, David Rientjes <rientjes@google.com> wrote:
>> From: Con Kolivas <kernel@kolivas.org>
>>
>> When kswapd is awoken due to reclaim by a running task, set the priority
>> of kswapd to that of the task allocating pages thus making memory reclaim
>> cpu activity affected by nice level.
>>
>> [rientjes@google.com: refactor for current]
>> Cc: Mel Gorman <mel@csn.ul.ie>
>> Signed-off-by: Con Kolivas <kernel@kolivas.org>
>> Signed-off-by: David Rientjes <rientjes@google.com>
>> ---
>>  mm/vmscan.c |   33 ++++++++++++++++++++++++++++++++-
>>  1 files changed, 32 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1658,6 +1658,33 @@ static void shrink_zone(int priority, struct zone *zone,
>>  }
>>
>>  /*
>> + * Helper functions to adjust nice level of kswapd, based on the priority of
>> + * the task allocating pages. If it is already higher priority we do not
>> + * demote its nice level since it is still working on behalf of a higher
>> + * priority task. With kernel threads we leave it at nice 0.
>> + *
>> + * We don't ever run kswapd real time, so if a real time task calls kswapd we
>> + * set it to highest SCHED_NORMAL priority.
>> + */
>> +static int effective_sc_prio(struct task_struct *p)
>> +{
>> +       if (likely(p->mm)) {
>> +               if (rt_task(p))
>> +                       return -20;
>> +               return task_nice(p);
>> +       }
>> +       return 0;
>> +}
>> +
>> +static void set_kswapd_nice(struct task_struct *kswapd, int active)
>> +{
>> +       long nice = effective_sc_prio(current);
>> +
>> +       if (task_nice(kswapd) > nice || !active)
>> +               set_user_nice(kswapd, nice);
>> +}
>> +
>> +/*
>>  * This is the direct reclaim path, for page-allocating processes.  We only
>>  * try to reclaim pages from zones which will satisfy the caller's allocation
>>  * request.
>> @@ -2257,6 +2284,7 @@ static int kswapd(void *p)
>>                                }
>>                        }
>>
>> +                       set_user_nice(tsk, 0);
>
> Why do you reset nice value which set by set_kswapd_nice?

My point is that you reset nice value(which is boosted at wakeup_kswapd) to 0
before calling balance_pgdat. It means kswapd could be rescheduled by nice 0
before really reclaim happens by balance_pgdat.
I think it would invalidate your goal which kswapd's priority can be inherited
by direct reclaimed process's one.

What am I missing now?

>
> --
> Kind regards,
> Minchan Kim
>



-- 
Kind regards,
Minchan Kim

--
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>

  reply	other threads:[~2010-03-02  4:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 10:14 [patch] mm: adjust kswapd nice level for high priority page allocators David Rientjes
2010-03-01 13:52 ` Mel Gorman
2010-03-01 17:56   ` David Rientjes
2010-03-01 18:04     ` Mel Gorman
2010-03-08 23:23       ` David Rientjes
2010-03-02 23:48   ` Andrew Morton
2010-03-01 16:02 ` Minchan Kim
2010-03-02  4:29   ` Minchan Kim [this message]
2010-03-03  0:14     ` David Rientjes
2010-03-03  6:25       ` Minchan Kim

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=28c262361003012029j1d17a0dch8987c0d6d939959e@mail.gmail.com \
    --to=minchan.kim@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel@kolivas.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=rientjes@google.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;
as well as URLs for NNTP newsgroup(s).