lkml.org 
[lkml]   [2018]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 1/2] printk: Add console owner and waiter logic to load balance console writes
From
Date
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:
>
>    This context
>    ------------
>    while (READ_ONCE(console_waiter)) /* Wait for the event */
>       cpu_relax();
>
>    Another context
>    ---------------
>    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 context
>    ---------
>    lock_map_acquire(wait); /* Or lock_map_acquire_read(wait) */
>                            /* Read one is better though..    */
>
>    /* A section, we suspect, a wait for an event might happen. */
>    ...
>    lock_map_release(wait);
>
>
>    The place actually doing the wait
>    ---------------------------------
>    lock_map_acquire(wait);
>    lock_map_acquire(wait);
^
lock_map_release(wait);

--
Thanks,
Byungchul

\
 
 \ /
  Last update: 2018-01-18 02:58    [W:0.085 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site