From patchwork Mon Oct 24 11:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555985wru; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e4Ph3/oKtcgujvOgoeD2hixTRvMII8LpDUjkpDRvLTiiR4TLJbV+cy0YgytjWi/tUehKU X-Received: by 2002:a05:6a00:238d:b0:563:b212:9257 with SMTP id f13-20020a056a00238d00b00563b2129257mr34260021pfc.21.1666630858596; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=PSoCh70AJqmpAK4q+cRKdr8DdZ6+BCTeQTqziOupVyOIEiw7xeqNylCP+MVqjBJVve d1R7VoivAvCmxqhoFV4BaWOuvRnF1fO+1lCysaaQvfNQYmPZ3vne1BTchRkFr5dA+qzk VpcyFfNl4awSAkJKc7fzUbOsjtwUHs13/4vtwBZ+F6RLpmMkca8U3D8O0SknOMjGx25l N17WjzbeebDWLb1o0RrEmGTvbo85yBB/NFG7vbys/QxHgEE4PACp4N/Y1DdUMzbQBDxZ vkpH17RqUIGy606H/n4plwOQP7jHVs3WuFDVmlvSi7Lp3+PjNj0Ezck+mg2K2Ygi0WDF BaaA== 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=c8ji6hNG/8lpqM0s6e2jhUqEfpjVrmEW5dH6PyEj+FU=; b=tptvWNIrHKboHAmW1wDsWRyusGDlxcMovHp54gRvR0nYBbMQm5pBdIgPMn13HQT/Rv q5UdehwBEEI2zTZhvcQj6XrgwWHwbD4zLMQ0eLaTmaVQL9JqJJkcYzb102OgnnoxC03S gWLu00kL4jDlwr5M7bf/4gw3Q1cxnKN0u1vQvXzpCHQGa/Eq5edO8wY4K1O/yZVCIEQ6 zQhhst0IoXkBByPKJKylPP/ub40ZilPQ1iConX9q+ESjl4gBiTDLb5X0LtD9EzxzRDF+ pB4gfVLWAKKc32KN60Bw5hVijNF8Fn0dy42M9PVgu8b6535M/Td+WfV6ZdcGk7Gl2qHo j5Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CwZs90bY; 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 x26-20020a63485a000000b00439e6a52bb4si34398489pgk.620.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -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=CwZs90bY; 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 S230486AbiJXQxb (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235368AbiJXQt2 (ORCPT ); Mon, 24 Oct 2022 12:49:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC460AE47; Mon, 24 Oct 2022 08:32:53 -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 6C68EB811DC; Mon, 24 Oct 2022 12:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC54AC433D6; Mon, 24 Oct 2022 12:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613206; bh=icTs9rKGCt1Miqe8tmTxHT+ggf/LGr/61YnBplZxuxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwZs90bYflhbvsKnFVHXovTftHjqt62SEUbxJGbmjGwj+bm1m/bMDFZZNavxCj7bY tDrtlcxk8lRScY1o5UX3aGMlvCAV6p3J3HWuKxwkFHHjVLtQJFGFrjw9v+YmZaiL+h 7fi5SMqjmUudtOB86VhSPJYJF25KLOChLvlwgzZY= 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.4 048/255] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024113004.034684859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747589119170638712?= X-GMAIL-MSGID: =?utf-8?q?1747589119170638712?= 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 @@ -662,7 +662,7 @@ int ring_buffer_wait(struct ring_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 &&