Re: [PATCH v2] printk: Add console owner and waiter logic to load balance console writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2 Nov 2017 13:06:05 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:


> +		raw_spin_lock(&console_owner_lock);
> +		waiter = console_waiter;
> +		console_owner = NULL;
> +		raw_spin_unlock(&console_owner_lock);
> +
> +		/*
> +		 * If there is a waiter waiting for us, then pass the
> +		 * rest of the work load over to that waiter.
> +		 */
> +		if (waiter)
> +			break;

OK, the spin_unlock() wont let the load leak. Thus it is fine as is.


> +			raw_spin_lock(&console_owner_lock);
> +			owner = console_owner;
> +			waiter = console_waiter;
> +			if (!waiter && owner && owner != current) {

But Mathieu Desnoyers pointed out that usage of variables within a
spinlock may be an issue. Although, it shouldn't affect the code as is,
I think I'll add back READ/WRITE_ONCE() just to be on the safe side.

I may add the waiter = READ_ONCE(console_waiter) to the first one too,
more as documentation. It should cause any issues to add it.

-- Steve



> +				console_waiter = true;
> +				spin = true;
> +			}
> +			raw_spin_unlock(&console_owner_lock);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux