From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46ED5C43219 for ; Sun, 28 Apr 2019 23:23:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FE4321473 for ; Sun, 28 Apr 2019 23:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726688AbfD1XMJ (ORCPT ); Sun, 28 Apr 2019 19:12:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45126 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbfD1XMI (ORCPT ); Sun, 28 Apr 2019 19:12:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EA538830E; Sun, 28 Apr 2019 23:12:08 +0000 (UTC) Received: from llong.remote.csb (ovpn-120-22.rdu2.redhat.com [10.10.120.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98FEB608C2; Sun, 28 Apr 2019 23:12:06 +0000 (UTC) Subject: Re: [PATCH-tip v7 00/20] locking/rwsem: Rwsem rearchitecture part 2 To: Linus Torvalds Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Linux List Kernel Mailing , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying References: <20190428212557.13482-1-longman@redhat.com> From: Waiman Long Organization: Red Hat Message-ID: <3f8fd44d-1962-e309-49b5-bb16fd662312@redhat.com> Date: Sun, 28 Apr 2019 19:12:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 28 Apr 2019 23:12:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/28/19 6:46 PM, Linus Torvalds wrote: > This doesn't seem to be the full diff - looking at that patch 1 you > seem to have taken my suggested list_cut_before() change too. > > I'm not against it (it does seem to be simpler and better), I just > hope you double-checked it, since I kind of hand-waved it. > > Linus I implemented your suggestion in patch 1 as it will produce simpler and faster code. However, one of the changes in my patchset is to wake up all the readers in the wait list. This means I have to jump over the writers and wake up the readers behind them as well. See patch 11 for details. As a result, I have to revert back to use list_add_tail() and list_for_each_entry_safe() for the first pass. That is why the diff for the whole patchset is just the below change. It is done on purpose, not an omission. Cheers, Longman > > On Sun, Apr 28, 2019 at 2:26 PM Waiman Long wrote: >> v6=>v7 diff >> ----------- >> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c >> index 97a2334d9cd3..60783267b50d 100644 >> --- a/kernel/locking/rwsem.c >> +++ b/kernel/locking/rwsem.c >> @@ -693,7 +693,7 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem, >> atomic_long_add(adjustment, &sem->count); >> >> /* 2nd pass */ >> - list_for_each_entry(waiter, &wlist, list) { >> + list_for_each_entry_safe(waiter, tmp, &wlist, list) { >> struct task_struct *tsk; >> >> tsk = waiter->task; >>