Re: [RFC 10/10] autonuma, memory tiering: Adjust hot threshold automatically

From: Huang\, Ying
Date: Mon Nov 04 2019 - 05:12:56 EST


Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> On Mon, Nov 04, 2019 at 02:11:11PM +0800, Huang, Ying wrote:
>> Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
>>
>> > On Fri, Nov 01, 2019 at 03:57:27PM +0800, Huang, Ying wrote:
>> >
>> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> >> index 0a83e9cf6685..22bdbb7afac2 100644
>> >> --- a/kernel/sched/fair.c
>> >> +++ b/kernel/sched/fair.c
>> >> @@ -1486,6 +1486,41 @@ static bool numa_migration_check_rate_limit(struct pglist_data *pgdat,
>> >> return true;
>> >> }
>> >>
>> >> +#define NUMA_MIGRATION_ADJUST_STEPS 16
>> >> +
>> >> +static void numa_migration_adjust_threshold(struct pglist_data *pgdat,
>> >> + unsigned long rate_limit,
>> >> + unsigned long ref_threshold)
>> >> +{
>> >> + unsigned long now = jiffies, last_threshold_jiffies;
>> >> + unsigned long unit_threshold, threshold;
>> >> + unsigned long try_migrate, ref_try_migrate, mdiff;
>> >> +
>> >> + last_threshold_jiffies = pgdat->autonuma_threshold_jiffies;
>> >> + if (now > last_threshold_jiffies +
>> >> + msecs_to_jiffies(sysctl_numa_balancing_scan_period_max) &&
>> >> + cmpxchg(&pgdat->autonuma_threshold_jiffies,
>> >> + last_threshold_jiffies, now) == last_threshold_jiffies) {
>> >
>> > That is seriously unreadable gunk.
>>
>> The basic idea here is to adjust hot threshold every
>
> Oh, I figured out what it does, but it's just really hard to read
> because of those silly variable names.
>
> This was just a first quick read through of the patches, and stuff like
> this annoys me no end. I did start a rewrite with more sensible variable
> names, but figured this might not be time for that.

Sorry about the poor naming. That is always hard for me.

> I still need to think and review the whole concept in more detail, now
> that I've read the patches. But I need to chase regressions first :/

Thanks for your help!

> FWIW, can you post a SLIT / NUMA distance table for such a system?

Sure. Will send you as attachment in another email.

Best Regards,
Huang, Ying