From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933076AbdCGRqi (ORCPT ); Tue, 7 Mar 2017 12:46:38 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:54593 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755652AbdCGRpm (ORCPT ); Tue, 7 Mar 2017 12:45:42 -0500 Date: Tue, 7 Mar 2017 18:45:04 +0100 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] locking/rwsem: Make rwsem_is_contended() track status of OSQ Message-ID: <20170307174504.GC3312@twins.programming.kicks-ass.net> References: <1488902628-14948-1-git-send-email-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1488902628-14948-1-git-send-email-longman@redhat.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 07, 2017 at 11:03:48AM -0500, Waiman Long wrote: > It was found that the current rwsem_is_contended() function did not > look at the status of the OSQ and hence would miss waiters on OSQ. So > that function is now modified to look at the OSQ as well. Ideally I'd kill the entire function. if (need_resched() || rwsem_is_contended(&fs_info->commit_root_sem)) { if (wakeup) caching_ctl->progress = last; btrfs_release_path(path); up_read(&fs_info->commit_root_sem); mutex_unlock(&caching_ctl->mutex); cond_resched(); mutex_lock(&caching_ctl->mutex); down_read(&fs_info->commit_root_sem); goto next; } is the only user of it in the entire tree and it makes no bloody sense what so ever. rwsem is a preemptible lock after all.