From patchwork Sat Oct 22 07:20:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089570wrr; Sat, 22 Oct 2022 00:43:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pSE5VbMpZ2TqKLERYSE/1QBJwG2o6gTwqIYrAQ4jLDCr8kBCWiBoL55u/peUCTy3qi9Y1 X-Received: by 2002:a05:6a00:1581:b0:563:36e1:38a8 with SMTP id u1-20020a056a00158100b0056336e138a8mr23883816pfk.80.1666424625645; Sat, 22 Oct 2022 00:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424625; cv=none; d=google.com; s=arc-20160816; b=UUdcj9HQWqmmAUGBnj7XJeGKwPS0MBHOzerbeQ5kaY/NoOs8rV14W+rTfeppeJEs7u Ay938Q7Pm/0Deq0D0lzaRwK1qsPoHK6jvsQK47XI6NYap47OU0SiJyD6W33q4vr3p5ej ZLWTMwpK/ZU6K6nV0fxo4heSGMb5hzwJfFCRCwA55WQkJQFI5cLtuFFQ7mGapvrK2uVq TFrJSvFs1VPMbg/fTZ92r5J6XQ8T4Q+VrwqBva60l55XrynZUy4Onxk1YnGYXmah4pRS xHu7GZYpBQ05UZIcc1ZdrygHZ6k4NLBUNCbxaIlhuZOj8UbA0iXXo42U3ajrs+eyyQtk 0/Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PNiAGidTY8HZy9wJ3VBB7riwl6/X15zvaN92xDtqPZg=; b=csB/h6ZA6wGDschDN/cZZkyjzWZ+3FIHthq1my/078bJll17Mwi3FjiNBgPKtjwM+t F1iYnxwYVbQQ+5aO2D2m0n2IRXHZKBnBrDRhMavgkQLrk+/BqnRr+zHZX/9tRmtprXYX ekcOJQhPO/LRo1sWK8Ppor5dnbTKm/WY35EpmrpN0J/lQSy0+5k/q3J4WlnJc404F09I 8ZmovCFoeY15wadE9qCBA7AKCGJJ2l3yb56myuBmPnbivG5v0+Zg593AdetrBSEpXvqb 95OmnjCXC7ZrfBNxnNSrHnLmm9KGLghyZHxbD+zQnThaEx0vRehOiBTcqUge0xKj5hl6 fDfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F5g1rnGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090aee8700b0020d67aeb299si1963520pjz.53.2022.10.22.00.43.33; Sat, 22 Oct 2022 00:43:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F5g1rnGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbiJVHnU (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiJVHmm (ORCPT ); Sat, 22 Oct 2022 03:42:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46336625F3; Sat, 22 Oct 2022 00:41:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32636B82DB2; Sat, 22 Oct 2022 07:40:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A99DC433C1; Sat, 22 Oct 2022 07:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424424; bh=TPb/yB1MCUdUFLId2liiAjLSSp0M8QMyY8PRDvoLSwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5g1rnGA8vevLb4LfwG3yPsLG/IBnd2z6fZS1DwMh1SMiP02B76M961320ZAvmnb6 OVJpnhaD7SUhWhgzPfz02LYtqP8kJgLHBGmOSFOPlXtzv5DzHfM8sKGkOrRgE/bZXD YJSlMl2qVo7NaQAszVsIT+M7WneiB2PogQtPg5sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 5.19 141/717] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Sat, 22 Oct 2022 09:20:20 +0200 Message-Id: <20221022072440.524799436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747372867907447024?= X-GMAIL-MSGID: =?utf-8?q?1747372867907447024?= From: Steven Rostedt (Google) commit 3b19d614b61b93a131f463817e08219c9ce1fee3 upstream. The logic to know when the shortest waiters on the ring buffer should be woken up or not has uses a less than instead of a greater than compare, which causes the shortest_full to actually be the longest. Link: https://lkml.kernel.org/r/20220927231823.718039222@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 2c2b0a78b3739 ("ring-buffer: Add percentage of ring buffer full to wake up reader") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1011,7 +1011,7 @@ int ring_buffer_wait(struct trace_buffer nr_pages = cpu_buffer->nr_pages; dirty = ring_buffer_nr_dirty_pages(buffer, cpu); if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy &&