Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752156AbdIFIgp (ORCPT ); Wed, 6 Sep 2017 04:36:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:47780 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbdIFIgl (ORCPT ); Wed, 6 Sep 2017 04:36:41 -0400 Date: Wed, 6 Sep 2017 10:36:29 +0200 (CEST) From: Thomas Gleixner To: "chengjian (D)" cc: huawei.libin@huawei.com, mingo@redhat.com, peterz@infradead.org, dvhart@infradead.org, linux-kernel@vger.kernel.org Subject: Re: a competition when some threads acquire futex In-Reply-To: <555186f2-8240-f7d0-e1b0-9ad1a67ff34c@huawei.com> Message-ID: References: <3e497508-876f-6474-3f3d-acab06a63b55@huawei.com> <555186f2-8240-f7d0-e1b0-9ad1a67ff34c@huawei.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 889 Lines: 33 On Wed, 6 Sep 2017, chengjian (D) wrote: > > > diff --git a/kernel/futex.c b/kernel/futex.c > > > index 3d38eaf..0b2d17a 100644 > > > --- a/kernel/futex.c > > > +++ b/kernel/futex.c > > > @@ -1545,6 +1545,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 > > > uval, > > > struct futex_pi_state *pi_ > > > spin_unlock(&hb->lock); > > > wake_up_q(&wake_q); > > > + _cond_resched( ); > > > I wrote _cond_resched( ) in futex_wake( ) which will be called to wake up > waiters > when the process release the futex. > > > But the patch producted by git format-patch displayed in wake_futex_pi( ). Ok. Still that patch has issues. 1) It's white space damaged. Please use TAB not spaces for indentation. checkpatch.pl would have told you. 2) Why are you using _cond_resched() instead of plain cond_resched(). cond_resched() is what you want to use. Thanks, tglx