Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp67969pxb; Tue, 2 Mar 2021 19:27:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxo3OyAFI/H01XK89fTJ9fMRqB8HabE+qARlXEamKNXmYZaeG8AtjKuxY5RNMqg6V86dG4E X-Received: by 2002:a17:906:9501:: with SMTP id u1mr14341514ejx.324.1614742031495; Tue, 02 Mar 2021 19:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614742031; cv=none; d=google.com; s=arc-20160816; b=Ij+D2OJxlB2MmRXOnTIndV+1q2Y473u0Vlcvr3UaDygX/5JZaxIJPBMM+dxf5IUyYR xKvaUt6altW6qXum3jbl3dihd1w257EJ8Fafj8Xy3zAyFgT4HnJrZZme4OehB/30kAaz MJV9w1m25ZWGCS0tg8bMo1c5TQ6WH3UbEM9kP2ti8A+4HO/2bqIYpnRfxLL+dGz4P/GE qBEy+YhIlGU2Ym/FSENXp+FYut/JY36XWwqCawq23XacYfwzQtv/dggb7Ba4OFvxhdYO h1DsAr624qQR3Yg5jOQHmh0hKr7GpI6LHfvUIdEMxyZ27nTcr56FwNwI4FbzQvuU3PMe YrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=rhXaCrKGBrwKHgr4ALQuoS3wuzW8zZ5ehlsEWxHaNhA=; b=IkYuV3eNbNcIJC75jJrUiuPEL/hrUj9j6/2yZZeV6UZ9uL65h9mdg+jqXIE1ug4buQ FdOMLMG8WDlQbGZTvhNye7wbDSkzJ/Vq5Gr2DjruLxuqKkFCAYeE9ht6Osse2/A5wU+G YQ/2E6UXBTpBkX6zVCoYfRE3MXrvRvVeXZxZ3pPFNZHtQTIb0+T8xkUV2gD7JWb1EMAC DX9IeW6E2PbqnC0CTqVcNK26yoS0zAzYcXFNRDfbVD9F2gQXeo9K/+9ec4AbjhKfrVcO gtPF6R8T8JIsDcOGmlqEpkGallcgdT7lzN7mUCqdCHY6SSK+5kyr6NC8XT0yJfpr3bW7 fRjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kroah.com header.s=fm3 header.b="BkJABv/U"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NxpqRKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si14951341ejv.446.2021.03.02.19.26.49; Tue, 02 Mar 2021 19:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kroah.com header.s=fm3 header.b="BkJABv/U"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NxpqRKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235597AbhCANWD (ORCPT + 99 others); Mon, 1 Mar 2021 08:22:03 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45053 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235387AbhCANWA (ORCPT ); Mon, 1 Mar 2021 08:22:00 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 43EA05C00C2; Mon, 1 Mar 2021 08:21:14 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 01 Mar 2021 08:21:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=rhXaCrKGBrwKHgr4ALQuoS3wuzW 8zZ5ehlsEWxHaNhA=; b=BkJABv/UN0FesDTDJ375bWUXO3ZJDTRQBTdPgj6wMm4 dQkr3/DWyRSVUWZ/vffzW3Xy0TzWwdHYchsTRCEVElBAwgd7mt5xCzUFdWf4uGrJ U3uRrOUCysVt4ZhqTxZ2eUbmBkvwEQgJ+/OSLOK69o/NpaCpft4tMEdtUSrAzgmj kX6IJyiXm/J0lWb4T92z6D8ilGaHV4cXWCZMQTUG6r56uyGdi6vqhX48/98RG8Sk XffXAMZGODUbgrymtIFFnUhWayBbsxCmPvTT314jNM1gMlfy0EXOLrlg80q+QM00 6LuLkcmI8iRn01SXNFBFN0mBdgSnhfQX0i/891HCaYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=rhXaCr KGBrwKHgr4ALQuoS3wuzW8zZ5ehlsEWxHaNhA=; b=NxpqRKOpbDfQ8GbIn+h41L TdrRSO5j9g+5E16q2RElredigI1eoVx+Zmfy5VJ0Wj25E23otkwT9tF/W/sdZ50Z 7InNXg75QOjMG6GZ865BpQ9R7dEUcg95nAYF7G8j/rk+iFfzVFBpiOl/QDbKWaTA IRCYB1YPEZ+5gRQsItcyC6KZbXpy22g2IsVX3ho2xgeLIMgLLVnXqvNtQEnpcJCJ TZ55CuTBXwPr6yLxromS3cu54yx5af+NSTNQf1hxiqi7zYc+WAzmWErf+KsMIfpz 8cCxXZB/8EPwnYiuEiSbieijqxrVYyy/z7D4ACzyMy4NjS1imSCQ88iu27lf+prw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrleekgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghgucfm jfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepveeuheejgf ffgfeivddukedvkedtleelleeghfeljeeiueeggeevueduudekvdetnecukfhppeekfedr keeirdejgedrieegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 6E25D1080064; Mon, 1 Mar 2021 08:21:13 -0500 (EST) Date: Mon, 1 Mar 2021 14:21:11 +0100 From: Greg KH To: Petr Mladek Cc: stable@vger.kernel.org, John Ogness , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , "J. Avila" , kernel test robot , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] printk: avoid prb_first_valid_seq() where possible Message-ID: References: <20210211173152.1629-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 10:02:14AM +0100, Petr Mladek wrote: > On Thu 2021-02-11 18:37:52, John Ogness wrote: > > If message sizes average larger than expected (more than 32 > > characters), the data_ring will wrap before the desc_ring. Once the > > data_ring wraps, it will start invalidating descriptors. These > > invalid descriptors hang around until they are eventually recycled > > when the desc_ring wraps. Readers do not care about invalid > > descriptors, but they still need to iterate past them. If the > > average message size is much larger than 32 characters, then there > > will be many invalid descriptors preceding the valid descriptors. > > > > The function prb_first_valid_seq() always begins at the oldest > > descriptor and searches for the first valid descriptor. This can > > be rather expensive for the above scenario. And, in fact, because > > of its heavy usage in /dev/kmsg, there have been reports of long > > delays and even RCU stalls. > > > > For code that does not need to search from the oldest record, > > replace prb_first_valid_seq() usage with prb_read_valid_*() > > functions, which provide a start sequence number to search from. > > > > Fixes: 896fbe20b4e2333fb55 ("printk: use the lockless ringbuffer") > > Reported-by: kernel test robot > > Reported-by: J. Avila > > Signed-off-by: John Ogness > > Could you please push this fix into the stable releases > based on 5.10 and 5.11, please? > > The patch fixes a visible performance regression. It has > landed in the mainline as the commit > 13791c80b0cdf54d92fc542 ("printk: avoid prb_first_valid_seq() where > possible"). > > It should apply cleanly. Already queued up, thanks. greg k-h