Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

From: Jason Low
Date: Tue Aug 16 2016 - 16:24:28 EST


On Thu, 2016-08-11 at 04:01 +0800, kbuild test robot wrote:
> Hi Jason,
>
> [auto build test ERROR on tip/locking/core]
> [also build test ERROR on v4.8-rc1 next-20160809]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Jason-Low/locking-mutex-Prevent-lock-starvation-when-spinning-is-enabled/20160811-034327
> config: x86_64-randconfig-x013-201632 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All error/warnings (new ones prefixed by >>):
>
> kernel/locking/mutex.c: In function 'do_yield_to_waiter':
> >> kernel/locking/mutex.c:441:10: error: 'struct mutex' has no member named 'yield_to_waiter'
> if (lock->yield_to_waiter != true)
> ^~
> kernel/locking/mutex.c:442:7: error: 'struct mutex' has no member named 'yield_to_waiter'
> lock->yield_to_waiter = true;
> ^~
> kernel/locking/mutex.c: In function 'clear_yield_to_waiter':
> kernel/locking/mutex.c:447:6: error: 'struct mutex' has no member named 'yield_to_waiter'
> lock->yield_to_waiter = false;
> ^~
> kernel/locking/mutex.c: In function 'need_yield_to_waiter':
> kernel/locking/mutex.c:452:13: error: 'struct mutex' has no member named 'yield_to_waiter'
> return lock->yield_to_waiter;
> ^~

These compilation errors occur in the !SMP case where the
yield_to_waiter variable does not get defined in the mutex structure,
but the waiter yield functions still make use of the variable.

They should be addressed by also checking for #if defined(CONFIG_SMP)
when defining those functions as Waiman had suggested.

Thanks,
Jason