From patchwork Mon Oct 24 11:27:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441777wru; Mon, 24 Oct 2022 06:06:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48JMPb+nSFV/cteWgR9/tYSXQkYXvCXB0tATSWvNnuMWYBR1YEHbFZb+FmwGTB84EpCrxk X-Received: by 2002:a17:90a:a401:b0:20a:da56:b073 with SMTP id y1-20020a17090aa40100b0020ada56b073mr38873704pjp.1.1666616783597; Mon, 24 Oct 2022 06:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616783; cv=none; d=google.com; s=arc-20160816; b=DkaMrZJGD7iP0G3ctczQTFhVWTQExKDkiEHY+4WPulqP6MuSxgwbKiZv8Gpa0Bgq2O r7SfCFueLngBXcc7Fi7720WAx3QmREIWgMwGgMZpkqDLjlboWCLFNDXyV3OKaGYtJKdP dytgtXW+dLuj3f94LlB5jMafjTD47TG6mUyl+PFXvNaJ3jGwbOc7SN1M0puqAl6C7AKi yHtB0lUMUlfvvso3y4tEcIZl2qiUN3V3yU4NFgVK1LKUvAv3R814fCiXLSicwsOrl9l2 y8hvfoHFKVaWS0FO+QwDviB7xnAVE/9cfk3lgkAkZ1tOFBcRN7ONTOc7T9SIF8aI+YXh oNqA== 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=55BmYCgW8UYGV5F1LnPajnKAXfB+92StyzY+WcG0CdQ=; b=QyV2UoKZ1SDirKeC9qRoGp+8FY18JwRIuCBf8ERGKoEf4hRWiGQzN+amni6XLIzOkx EsTaTSBWnoRxbPWoQA+we+o//r1SjKFaqYL4yHwr9RH8izYd3i93YggmC3bjV+k+Hf2E 8vSZLygFgY82UJ+B1wqhqw/yfEXIZvgQTRScxoLu+XsEzKVGm1JSTnlwD2YlmKIomw+B GGb6aeJxX5Hwgufk066Z89TEBBXXh1tHMoPwIr5gYCBJu18jpYcrMTjESILwTJu7XcKO U6G4hdDE7zG3gkdjlpqIJEsJdTRpnDsE2um8t7OXTsYngZu4O1fUID7BV6heiGcdfswP 4fKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1RPQulf4; 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 s138-20020a632c90000000b0044db77667ebsi34986326pgs.3.2022.10.24.06.05.59; Mon, 24 Oct 2022 06:06:23 -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=1RPQulf4; 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 S235179AbiJXNFL (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234949AbiJXNB5 (ORCPT ); Mon, 24 Oct 2022 09:01:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACB5360B0; Mon, 24 Oct 2022 05:20:02 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 08E2361252; Mon, 24 Oct 2022 12:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F05C433C1; Mon, 24 Oct 2022 12:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613947; bh=4/kpqSPyOkGTlBf5NsgC+YqUfzjRPva5Nu1gW9najIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1RPQulf4Ckb9JG8ExoyYhYsOyevlcHlV5l7eqxKT9Ldb3PUakMh9XMbJSkcnU/Rdm kw15lR+b/3MzaQv6M3TalbTIaxy7qAP5jieor3FKAvbaQn+o4F5JeE1wLGhErTUHSs tC5EPtkRKfh65IomXKeTgAJ7/9odzQnHR4aI+Z7c= 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.10 074/390] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Mon, 24 Oct 2022 13:27:51 +0200 Message-Id: <20221024113025.760158677@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747574360519880905?= X-GMAIL-MSGID: =?utf-8?q?1747574360519880905?= 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 @@ -888,7 +888,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 &&