From patchwork Wed Oct 19 08:24:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205953wrs; Wed, 19 Oct 2022 01:51:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ll1JRFO7oMAWFc2jSpZaMVQjIfp+2VAh4T5DPSU9tA8O98hY2KXqhm+c4YAGyjQ8nA+aN X-Received: by 2002:a63:ff1b:0:b0:43c:e4ee:e5e0 with SMTP id k27-20020a63ff1b000000b0043ce4eee5e0mr6059446pgi.540.1666169467157; Wed, 19 Oct 2022 01:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169467; cv=none; d=google.com; s=arc-20160816; b=JS6ZWF+cfBRxqR7evW4YgB24XCIISQFB6tNH75n8zcIjwokKBebHK5flmg9+lPuyl+ 52SondSz54YXKjuVDGfai6r7QPr8iBLxDIqxqfNf0awAaGpqq8TTmGm1G0juO1JtBGXS hlaHcPkpER60/N29eim9Hg7bu1skhnOV8yjyqkij6kfpJtjJAWMeEAxwdOJihgUHcMlu sdMfolHBGHHa5Ysx2G8h+glnLsHRLOmehsuhJ4CITqYquC0DH7v9uZTNbPSGhyceEmEY x1aqFGqHVpk8AfBEqMXOeQeILDfmEog/MXeo9fTb3JTGy3KJG9QbHDmi5JZKgAgnGb9t rrsw== 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=alPpLm45X7NQGtmCkJoAc4TpvGmGRQja2ukdTrLzsPyC/NhE0UpzJNHyeueRclGjQi OUGywLt58oIQgUU1CgnvjUqVvj3YXLFinB25scafgwwmXmCmSTpvMqLHdpCNSuDXlgbu V2uL7lKFsIBT0dZVojEurbzdEzj9bCI9xafPrTEZneJxyxBUUBGu8Yev8Rypod1/uZKg PlsgPaTXXW9sXMCxn8m7869WfO9heupgAUwdPy8EgFhhb8gRRlJB4FL9oY5bQCOA3Z50 CRJF2ypriD5JtVU/x0SKTBvuDJuoo99Fr/ODykS/kIFgtIeffwzV5kwC57CTM+MReVfg 6zCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny3Pigbp; 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 a10-20020a63d20a000000b00461bf5f86fdsi17741758pgg.403.2022.10.19.01.50.54; Wed, 19 Oct 2022 01:51:07 -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=Ny3Pigbp; 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 S231329AbiJSIul (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiJSIsk (ORCPT ); Wed, 19 Oct 2022 04:48:40 -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 8BE808E98A; Wed, 19 Oct 2022 01:46:23 -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 7922861825; Wed, 19 Oct 2022 08:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80CF7C433D6; Wed, 19 Oct 2022 08:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169165; bh=TPb/yB1MCUdUFLId2liiAjLSSp0M8QMyY8PRDvoLSwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ny3PigbpdViTmHgu4ImEvdw6hCn6osHvgi9y8fVcCf77fov6OJLFAcfYij+2kHHej d7U6l/uU1tCAv5GjMDSbJA+W4iL2u8YOdalNsNeRShE1WlRRmmb3tFZLRgZ39aVJjH YkiOBrFW8k0dl6IDDRNmOTmDZUu3a8vUGebmdAuI= 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 6.0 153/862] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Wed, 19 Oct 2022 10:24:00 +0200 Message-Id: <20221019083256.746206975@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747105315245706397?= X-GMAIL-MSGID: =?utf-8?q?1747105315245706397?= 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 &&