From nobody Fri Oct 17 10:31:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D54FBC433FE for ; Wed, 19 Oct 2022 08:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbiJSIum (ORCPT ); Wed, 19 Oct 2022 04:50:42 -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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 w= ake 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 =3D cpu_buffer->nr_pages; dirty =3D 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 =3D full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy &&