From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933554AbcBCHlM (ORCPT ); Wed, 3 Feb 2016 02:41:12 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36652 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933155AbcBCHlL (ORCPT ); Wed, 3 Feb 2016 02:41:11 -0500 Date: Wed, 3 Feb 2016 16:42:23 +0900 From: Sergey Senozhatsky To: Ingo Molnar Cc: Byungchul Park , willy@linux.intel.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, akinobu.mita@gmail.com, jack@suse.cz, sergey.senozhatsky.work@gmail.com, peter@hurleysoftware.com, Linus Torvalds Subject: Re: [PATCH v2] lock/semaphore: Avoid an unnecessary deadlock within up() Message-ID: <20160203074223.GB30520@swordfish> References: <1454479377-24434-1-git-send-email-byungchul.park@lge.com> <20160203072847.GA32026@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160203072847.GA32026@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (02/03/16 08:28), Ingo Molnar wrote: [..] > So why not move printk away from semaphores? Semaphores are classical constructs > that have legacies and are somewhat non-obvious to use, compared to modern, > simpler locking primitives. I'd not touch their implementation, unless we are > absolutely sure this is a safe optimization. semaphore's spin_lock is not the only spin lock that printk acquires. it also takes the logbuf_lock (and different locks in console drivers (up to console driver)). Jan Kara posted a patch that offloads printing job (console_trylock()-console_unlock()) from printk() call (when printk can offload it). so semaphore and console driver's locks will go away (mostly) with Jan's patch. logbug spin_lock, however, will stay. -ss