Re: [PATCH v5 1/2] printk: Add console owner and waiter logic to load balance console writes

Byungchul Park
2018-01-18T01:57:17Z

On 1/18/2018 10:53 AM, Byungchul Park wrote:
> Hello,
>
> This is a thing simulating a wait for an event e.g.
> wait_for_completion() doing spinning instead of sleep, rather
> than a spinlock. I mean:
>
> A A This context
> A A ------------
> A A while (READ_ONCE(console_waiter)) /* Wait for the event */
> A A A A A cpu_relax();
>
> A A Another context
> A A ---------------
> A A WRITE_ONCE(console_waiter, false); /* Event */
>
> That's why I said this's the exact case of cross-release. Anyway
> without cross-release, we usually use typical acquire/release
> pairs to cover a wait for an event in the following way:
>
> A A A context
> A A ---------
> A A lock_map_acquire(wait); /* Or lock_map_acquire_read(wait) */
> A A A A A A A A A A A A A A A A A A A A A A A A A A /* Read one is better though..A A A */
>
> A A /* A section, we suspect, a wait for an event might happen. */
> A A ...
> A A lock_map_release(wait);
>
>
> A A The place actually doing the wait
> A A ---------------------------------
> A A lock_map_acquire(wait);
> A A lock_map_acquire(wait);
^
lock_map_release(wait);

--
Thanks,
Byungchul