From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753343AbeARB5S (ORCPT ); Wed, 17 Jan 2018 20:57:18 -0500 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:51364 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752306AbeARB5R (ORCPT ); Wed, 17 Jan 2018 20:57:17 -0500 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.184 X-Original-MAILFROM: byungchul.park@lge.com Subject: Re: [PATCH v5 1/2] printk: Add console owner and waiter logic to load balance console writes From: Byungchul Park To: Petr Mladek Cc: Steven Rostedt , Sergey Senozhatsky , akpm@linux-foundation.org, linux-mm@kvack.org, Cong Wang , Dave Hansen , Johannes Weiner , Mel Gorman , Michal Hocko , Vlastimil Babka , Peter Zijlstra , Linus Torvalds , Jan Kara , Mathieu Desnoyers , Tetsuo Handa , rostedt@rostedt.homelinux.com, Sergey Senozhatsky , Tejun Heo , Pavel Machek , linux-kernel@vger.kernel.org, kernel-team@lge.com References: <20180110132418.7080-1-pmladek@suse.com> <20180110132418.7080-2-pmladek@suse.com> <20180117120446.44ewafav7epaibde@pathway.suse.cz> <4a24ce1d-a606-3add-ec30-91ce9a1a1281@lge.com> Message-ID: <7a107b1e-f99f-186b-f5db-504b7691993d@lge.com> Date: Thu, 18 Jan 2018 10:57:13 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <4a24ce1d-a606-3add-ec30-91ce9a1a1281@lge.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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