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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0168DC4338F for ; Thu, 5 Aug 2021 15:45:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB4DE61131 for ; Thu, 5 Aug 2021 15:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242859AbhHEPqE (ORCPT ); Thu, 5 Aug 2021 11:46:04 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44026 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242509AbhHEPmq (ORCPT ); Thu, 5 Aug 2021 11:42:46 -0400 Message-ID: <20210805153956.051961951@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1628178151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=L89kb3bK/8i7QLZQxNCKbjHrAz7lR5evlX/81M/CJ6U=; b=kElMHNfmvfG9ssjeyjhpTaTctLAjFmr/4kdv2HDweuOF1JWswmJMXGegxTQ2Ri84vDIZHj ELhJnIqtqFA0IHSyu/9zBiIJG4zfuGg1b1E+u3fQA7Wk5/5bCAoulM6Dfv+Sa/wBUvSvRv DxkxQ9PR0B7Ifo7feY3QvIbdhEswbvOhQwmbeXR2FFDOZWWJF6Tt3jkcJ3VqDh/33Mfl/3 hIE+TrMWDUtniv8sRqD0nB0djJuiAFDxkPMmQALyIFaEgnMRIePy6hEqS6ocIPTMfpYbVv kGLU4bmLdkLGasfwPEnFj2sMJ8qXMHb2AEDABFVKSn2qfv6OZluhsHWGYlxr2w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1628178151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=L89kb3bK/8i7QLZQxNCKbjHrAz7lR5evlX/81M/CJ6U=; b=1TlWqzGwPHunNzWhfFZCPU8QapZz3hAg/lfCEQPAG4Lj+jZD4MKy+CY1qB5b4gr14cZm0A sSSHGDP88A+s2vAQ== Date: Thu, 05 Aug 2021 17:13:56 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Steven Rostedt , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , Sebastian Andrzej Siewior , Davidlohr Bueso , Mike Galbraith Subject: [patch V3 56/64] futex: Correct the number of requeued waiters for PI References: <20210805151300.330412127@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner The accounting is wrong when either the PI sanity check or the requeue PI operation fails. Adjust it in the failure path. Will be simplified in the next step. Signed-off-by: Thomas Gleixner --- kernel/futex.c | 4 ++++ 1 file changed, 4 insertions(+) --- --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2131,6 +2131,8 @@ static int futex_requeue(u32 __user *uad /* Ensure we requeue to the expected futex for requeue_pi. */ if (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) { + /* Don't account for it */ + task_count--; ret = -EINVAL; break; } @@ -2172,6 +2174,8 @@ static int futex_requeue(u32 __user *uad */ this->pi_state = NULL; put_pi_state(pi_state); + /* Don't account for it */ + task_count--; /* * We stop queueing more waiters and let user * space deal with the mess.