Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3772443pxb; Sun, 7 Feb 2021 22:47:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWGWynmsv7Jp0SbgHR3Pewo5gUUiRC23weqnvprvGpmFuEQGSWh+vZZtIujtneAaiYbUr6 X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr15615764edw.290.1612766820400; Sun, 07 Feb 2021 22:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612766820; cv=none; d=google.com; s=arc-20160816; b=a9EHbicTOzXI0aAQNzA90PWPqb+AOdO2g/hDgZQneTFGrjJSY4p0PCTP9DiSK5xwwe 3Q7TQ3nyTPurH+wAM40Hx/Te7K1YVDW8lpiAnuCPONaiHAKg4jrPeNv3t+dQM4GVCJyG dnwujTGCja8ii4ACrIUzGn+el5+Dl//CJzUDIqRizJPKNWrLmJAEvPglHkdXcQ4GIr8Y KVOUbMGTB3Lx4H1pquPr46jFVhbKFEE0R3+iQdPhGqxVyMc9LAy7SDE2BvepackA4gFm gDsF6TNnlsDs2FNLUif1i8xkyYSOKpPPbz+4rvWtjW0LuYRfg/1z3c7kAZmy/1tEQeaA eB7A== 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; bh=+803h1HDJSZ65Cad0OUtvZ9NiqoyELYv2f6+XgldWy0=; b=Dn21fmqujRQ8KcnO16hIEL5T2WRD6/Cr8j3qD6VBydjzAq3CPbtHV1BXxfsWFZ+K2F m62kb9kweHFBEEw2PnYupIo+jh7AdApX2LnDk4tbEIlEnOE5ZV6n5MpAKPTF2KQRqoKR PqzXR3MbxfyUwWeaeYI/j1NjWSe/qocn0EFY2EzTZ0RymW6wEn0FjnbH3S+y+IsWxyyp yYpmSjrBG3jD+LsrwKV5ElbUm8NZXF4EOjPmNse87jPe3CzbyBzMwl/FGm9fFImFv3NK jYTJp781TN4Wp3TTlkdt3DaT8B4sP85GGD4Vk7/eStS8C52R+EuyZGkFDtZevOF7xcI+ 15RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Um6hny/z"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si11298517ejb.592.2021.02.07.22.46.37; Sun, 07 Feb 2021 22:47:00 -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=@gmail.com header.s=20161025 header.b="Um6hny/z"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbhBHGpC (ORCPT + 99 others); Mon, 8 Feb 2021 01:45:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbhBHGo7 (ORCPT ); Mon, 8 Feb 2021 01:44:59 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC898C06174A for ; Sun, 7 Feb 2021 22:44:19 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id e7so626212pge.0 for ; Sun, 07 Feb 2021 22:44:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+803h1HDJSZ65Cad0OUtvZ9NiqoyELYv2f6+XgldWy0=; b=Um6hny/zYIiUx7IHlv7srN/EmCf0qR9Q61d+qDDzb5pbG65J3oHz3hyBmNV0sbRsqZ 5UnrtIO+HdeX0bIVslqbY16aVo+7tqU+dzJx5vLWPksxrjVUeuZ8w3xl7ZDcPV55+Al3 MOP9U0f/0WPIcubNQmezZzO6kP8OlqmgWzZ9j21iM8xIJ49h+y+f523ExHyJwBEGkxhu Fn6vbrpOS03WGVrdmvdeqWC2Plf3yLlYBbCGupDL3tnqWr9WnZ2sPEic0pjT+Mpqbp9/ TYBWNj92YGPr9IFTJP+BsQ/gviDYfeEMkk6PakVOK5LAHkEN9Zt2iYmUSzMC4cGCy+bU YyNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+803h1HDJSZ65Cad0OUtvZ9NiqoyELYv2f6+XgldWy0=; b=Js2935pMUkIzKKPr/220bk1XKsdsgCxTFMop+EvXaSHMkqKOfxvGhLGcx9TbCuGH83 Ob+uEdnt+dPuWL+CnMMioiK5q5YTzI+069pRKLOAUDFbB9nCXpwqWKOr2pO+SkLadLXx 3HQxU1bXbzV8+t3fr8c06JRPwr76zZILw1zgIJeTiXq2piR6jJQx1vp7OZxAvwdNq1km eK7y7Kw3jh9hBsMkWhwh/dDTJmnDlEHzMWj848Ozf1ZVXaqr16eg+r3Munyt08RFY/oQ L+JPNN/4S5W3/fRdfScz98Yu/kaFDSUm3fBIzmkVnsl5tTU/Jg/taBXHDJUXkHehCRwJ jK5w== X-Gm-Message-State: AOAM533DPlAvMtJcfGppsk/YuLaQik1kFimSWq9Of10byDVSZgXGvxCU 0CB4Oqwo/QHL68/KjwbixIs= X-Received: by 2002:a65:60d1:: with SMTP id r17mr16273336pgv.210.1612766659149; Sun, 07 Feb 2021 22:44:19 -0800 (PST) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id y14sm8814965pjg.52.2021.02.07.22.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 22:44:18 -0800 (PST) Date: Mon, 8 Feb 2021 15:44:17 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org, "J. Avila" Subject: Re: [PATCH] printk: avoid prb_first_valid_seq() where possible Message-ID: References: <20210205141728.18117-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210205141728.18117-1-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (21/02/05 15:23), 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 Can we please also ask the kernel test robot to test this patch? -ss