From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756036AbdKCLSa (ORCPT ); Fri, 3 Nov 2017 07:18:30 -0400 Received: from smtprelay0238.hostedemail.com ([216.40.44.238]:34631 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750826AbdKCLS3 (ORCPT ); Fri, 3 Nov 2017 07:18:29 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4184:4304:4321:4411:4432:5007:6261:6742:7875:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12438:12663:12740:12760:12895:13069:13161:13229:13255:13311:13357:13439:14096:14097:14180:14181:14659:14721:21060:21080:21324:21611:21627:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: paste48_83e68c1da144f X-Filterd-Recvd-Size: 2758 Date: Fri, 3 Nov 2017 07:18:24 -0400 From: Steven Rostedt To: Jan Kara Cc: Tetsuo Handa , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Cong Wang , Dave Hansen , Johannes Weiner , Mel Gorman , Michal Hocko , Petr Mladek , Sergey Senozhatsky , Vlastimil Babka , "yuwang.yuwang" , Peter Zijlstra , Linus Torvalds , Mathieu Desnoyers Subject: Re: [PATCH v2] printk: Add console owner and waiter logic to load balance console writes Message-ID: <20171103071824.1cf629ee@vmware.local.home> In-Reply-To: <20171103101953.GA5280@quack2.suse.cz> References: <1509017339-4802-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <20171102115625.13892e18@gandalf.local.home> <20171102130605.05e987e8@gandalf.local.home> <20171103101953.GA5280@quack2.suse.cz> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Nov 2017 11:19:53 +0100 Jan Kara wrote: > Hi, > > On Thu 02-11-17 13:06:05, Steven Rostedt wrote: > > + if (spin) { > > + /* We spin waiting for the owner to release us */ > > + spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_); > > + /* Owner will clear console_waiter on hand off */ > > + while (!READ_ONCE(console_waiter)) > > + cpu_relax(); > > Hum, what prevents us from rescheduling here? And what if the process > stored in console_owner is scheduled out? Both seem to be possible with > CONFIG_PREEMPT kernel? Unless I'm missing something you will need to > disable preemption in some places... Yes you are missing something ;-) > > Other than that I like the simplicity of your approach. > > Honza > > > + > > + spin_release(&console_owner_dep_map, 1, _THIS_IP_); > > + printk_safe_exit_irqrestore(flags); The above line re-enables interrupts. And is done for both the console_owner and the console_waiter. These are only held with interrupts disabled. Nothing will preempt it. In fact, if it could, lockdep would complain (it did in when I screwed it up at first ;-) -- Steve