From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <mingo@redhat.com>, <kernellwp@gmail.com>, <riel@redhat.com>,
<tkhai@yandex.ru>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] sched/fair: Care divide error in update_task_scan_period()
Date: Wed, 22 Oct 2014 14:39:04 +0900 [thread overview]
Message-ID: <544742F8.80000@jp.fujitsu.com> (raw)
In-Reply-To: <20141021092112.GO23531@worktop.programming.kicks-ass.net>
(2014/10/21 18:21), Peter Zijlstra wrote:
> On Thu, Oct 16, 2014 at 06:48:15PM +0900, Yasuaki Ishimatsu wrote:
>> +++ b/kernel/sched/fair.c
>> @@ -1466,6 +1466,7 @@ static void update_task_scan_period(struct task_struct *p,
>>
>> unsigned long remote = p->numa_faults_locality[0];
>> unsigned long local = p->numa_faults_locality[1];
>> + unsigned long total_faults = shared + private;
>>
>> /*
>> * If there were no record hinting faults then either the task is
>> @@ -1496,6 +1497,14 @@ static void update_task_scan_period(struct task_struct *p,
>> slot = 1;
>> diff = slot * period_slot;
>> } else {
>> + /*
>> + * This is a rare case. total_faults might become 0 after
>> + * offlining node. In this case, total_faults is set to 1
>> + * for avoiding divide error.
>> + */
>> + if (unlikely(total_faults == 0))
>> + total_faults = 1;
>> +
>> diff = -(NUMA_PERIOD_THRESHOLD - ratio) * period_slot;
>>
>> /*
>> @@ -1506,7 +1515,7 @@ static void update_task_scan_period(struct task_struct *p,
>> * scanning faster if shared accesses dominate as it may
>> * simply bounce migrations uselessly
>> */
>> - ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
>> + ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (total_faults));
>> diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
>
> So what was wrong with the 'normal' unconditional +1 approach? Also
> you've got superfluous parenthese.
>
When (private + shared) was not 0, I did not want to change behavior of
update_task_scan_period(). But I understood your comment. I'll update it.
Thanks,
Yasuaki Ishimatsu
prev parent reply other threads:[~2014-10-22 5:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 9:48 [PATCH v2] sched/fair: Care divide error in update_task_scan_period() Yasuaki Ishimatsu
2014-10-20 7:47 ` Yasuaki Ishimatsu
2014-10-21 9:21 ` Peter Zijlstra
2014-10-22 5:39 ` Yasuaki Ishimatsu [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=544742F8.80000@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=kernellwp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=tkhai@yandex.ru \
/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