From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH 03/11] locking, rwsem: introduce basis for down_write_killable Date: Thu, 7 Apr 2016 09:38:40 +0200 Message-ID: <20160407073840.GA32755@dhcp22.suse.cz> References: <1459508695-14915-1-git-send-email-mhocko@kernel.org> <1459508695-14915-4-git-send-email-mhocko@kernel.org> <20160402044125.GC5329@linux-uzut.site> <20160404091659.GA13463@dhcp22.suse.cz> <20160407065807.GA29020@linux-uzut.site> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:35777 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260AbcDGHio (ORCPT ); Thu, 7 Apr 2016 03:38:44 -0400 Content-Disposition: inline In-Reply-To: <20160407065807.GA29020@linux-uzut.site> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Davidlohr Bueso Cc: LKML , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , "David S. Miller" , Tony Luck , Andrew Morton , Chris Zankel , Max Filippov , x86@kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org On Wed 06-04-16 23:58:07, Davidlohr Bueso wrote: > On Mon, 04 Apr 2016, Michal Hocko wrote: > > >Not sure I got your point here. > > You set current to TASK_KILLABLE in the sleep loop, why do you want to change > it here to TASK_RUNNING if its about to be killed? Wouldn't it be unexpected to return from a lock with something else than TASK_RUNNING? > At least in the case of > UNINTERRUPTABLE we do it merely as a redundancy after the breaking out of the > loop. Of course we also acquired the lock in the first place by that time and > we _better_ be running. I guess the reason was that rwsem_try_write_lock might suceed and we do not want to return with TASK_UNINTERRUPTIBLE in that case. -- Michal Hocko SUSE Labs