Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933449AbcCaUkm (ORCPT ); Thu, 31 Mar 2016 16:40:42 -0400 Received: from mail-by2on0137.outbound.protection.outlook.com ([207.46.100.137]:26091 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932514AbcCaUkk (ORCPT ); Thu, 31 Mar 2016 16:40:40 -0400 Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=none action=none header.from=hpe.com; Message-ID: <56FD8B3E.3000306@hpe.com> Date: Thu, 31 Mar 2016 16:40:30 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , , Linus Torvalds , Ding Tianhong , Jason Low , Davidlohr Bueso , "Paul E. McKenney" , Thomas Gleixner , Will Deacon , Tim Chen Subject: Re: [PATCH v3 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue References: <1458668804-10138-1-git-send-email-Waiman.Long@hpe.com> <1458668804-10138-3-git-send-email-Waiman.Long@hpe.com> <20160329153935.GL3408@twins.programming.kicks-ass.net> <20160329164233.GB11035@twins.programming.kicks-ass.net> In-Reply-To: <20160329164233.GB11035@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [72.71.243.178] X-ClientProxiedBy: SN1PR0701CA0036.namprd07.prod.outlook.com (10.162.96.46) To CS1PR84MB0311.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.29) X-MS-Office365-Filtering-Correlation-Id: 60cf9a2f-48f1-41e0-555a-08d359a4b7cc X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0311;2:mknPhmA/Ykowz0+YP67XqKmnZoktuAW7PvYm5exP05WAzrEMhwuVwV3HaZrYkax77Uy16h0GKW07HW696GCih8R6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dGL7HpDK98nRoD5Y9YF3G5SaOvxD4oBBeW+Qyb8xM1i4o76HsEQ09g3udsd81YzcsmJ8NOZVeWL++Miau2Xn7FtG3+avJPd+lrFpH4ye9AbWeTj6/BH9Sxj3lBqje1yvfmtZC4XFXm4CRIoQhhbxY5ooqRcALX2INySqRZrbB5H1wHyzBP3mYZWGooWW7Qw45abv3rCCNGLVg9h9dleAtOJsNLH1LIXSj+13HaCKA07sMGSsOj/ZQEKephQ7KKz0nd2Pw2u2ZlqJWgk/6mPHqN8g5xDmlgcENIElqaJYT1TBu+vv3IKQX9g925HyXGGdpu//0J5OR3b+aYDjzh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:CS1PR84MB0311;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0311; X-Forefront-PRVS: 0898A6E028 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(24454002)(377454003)(2906002)(36756003)(6116002)(4326007)(3846002)(2950100001)(23756003)(117156001)(50466002)(586003)(5004730100002)(93886004)(81166005)(77096005)(66066001)(59896002)(189998001)(64126003)(5008740100001)(4001350100001)(110136002)(65816999)(50986999)(76176999)(54356999)(87266999)(230700001)(47776003)(42186005)(65806001)(65956001)(1096002)(83506001)(92566002)(86362001)(33656002)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR84MB0311;H:[192.168.142.148];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;CS1PR84MB0311;23:wWg7G4QTb0Ti4JJgwDatJaZBv4O7NPBUZeIEdhq?= =?iso-8859-1?Q?IrIjJcpQNaSmoiPKfZe8fNiyw73G1lvJ90ABPq1qTTA7sC5l7xCap3aoai?= =?iso-8859-1?Q?9QPE1SvguGkzcq+UuSp4FMlY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-8859-1?Q?L+4pBJKPahPQhfyu375Bwf4HIXQ1svhsRHiQybeR/MGJEnEG/kY/E2iuoT?= =?iso-8859-1?Q?Za0p95wNJifiVCubtDiFan57eIfw3vNtXhE6ZAzsKgbVP9k3BxqznHmMiV?= =?iso-8859-1?Q?/b/592q8RaBHs2/qRUtaTg3wvCQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0311;5:bFvuwDPkIo6oECAfOrS2ajHbnLQrMB4KOLgiOSRHkCMyltNvK7evyDi2No5ltqC/MNSVKM652FDETGm/dWl0lwIW92MKFaMhByPi2RnT0yyIBnnjIWf2po/aUfpKDFUaijsz54o4d9ST3Yx/cRQz2w==;24:6Q7h4727v44sQVisAiNLB7gcddasoAiY/JaiRGlf2TDExe+wW1FKDMt965S4idTTCcqMW1lJE7Uq4cYpVwPSwBCxKi6EaKy2CcB+FNVSm0Y= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2016 20:40:37.0469 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0311 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1105 Lines: 24 On 03/29/2016 12:42 PM, Peter Zijlstra wrote: > On Tue, Mar 29, 2016 at 05:39:35PM +0200, Peter Zijlstra wrote: >> On Tue, Mar 22, 2016 at 01:46:43PM -0400, Waiman Long wrote: >>> Ding Tianhong reported a live-lock situation where a constant stream >>> of incoming optimistic spinners blocked a task in the wait list from >>> getting the mutex. >>> >>> This patch attempts to fix this live-lock condition by enabling the >>> woken task in the wait queue to enter into an optimistic spinning >>> loop itself in parallel with the regular spinners in the OSQ. This >>> should prevent the live-lock condition from happening. >> I would very much like a few words on how fairness is preserved. >> >> Because while the waiter remains on the wait_list while it spins, and >> therefore unlock()s will only wake it, and we'll only contend with the >> one waiter, the fact that we have two spinners is not fair or starvation >> proof at all. > Alternatively, we can say this is good enough until proven deficient, > but then we should still very much document this. Yes, we can certainly do that. Cheers, Longman