Received: by 2002:ac8:5349:0:b0:427:7d78:cd45 with SMTP id d9csp817390qto; Wed, 20 Dec 2023 05:00:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IECm/HTKLidtBqrq5kU8tp5TFjKc863VCzoaeqB78gapg2FZe4aEBhCc9H7s8GDEU6TlcaL X-Received: by 2002:ac2:548b:0:b0:50e:399d:f0d with SMTP id t11-20020ac2548b000000b0050e399d0f0dmr2174532lfk.93.1703077234820; Wed, 20 Dec 2023 05:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703077234; cv=none; d=google.com; s=arc-20160816; b=fovmTluclxfHm/vk62+VuPCp0IHJ5a2+hbR6R2oferQgelZ4xjl/aOHNg04BHnBwQK X3U+tAFITW6odyLYhYStEa+dCUCHMOiP+D9lvgxKK1x9qFIusqXZvsId7t35moivRVpa 2UWWpjA+rNjYTIxZ3NmIBBikOATm0MZ2jIKBBCW1+DXTontu4JworJAiQ7dgp+nd03Nw sY6g0QdTZXzes+Y5Xy+bwyj9lWY3Y8VuJxUeby1PwaOHJSNUTKjziWcXrQGjWvIXP/OF m1tjdYqSjjVNq/DYHmTZvN/S7njDabnXVd+o/Er5MOXx9utP66mua4Mg5olhjMYSK81U ej5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=ov7GWrmo9NfXCYbYNDH+8I/DRSiI3cUnPaLNOr0j2YI=; fh=sIiF0gytQxDmA7FJAnx7CvP1XwT6m22OedHn1daRdGk=; b=bbVM+wqpqNmIxU/786MlxaA83IMhA+Uvlw2sStGg85TwuZ2vbuUjgCNVW3Jijdppv7 d62p4ERA/NDVEEQhsY2tlZLygN3BpBhJnNG0BCPtBJkzMKtmQRDyt3JptoKt1Uin2tsr 67BXe61jZI4UvCblgCv/y5fRGXRAa829HqIq2EaJSoLaL246f2C6Tiyhfofc66PfpqLA gW1WhN7T5uquL2CQCt2sN1fAGNKOJVgAAzFpl6XK7Tr+K3HtMcKO0z4hy7C5Pf1uQI7Z bwwBOQq2jkIS2LaoA3B0Ih1K3qabSJIjrkjAMLY0uUt4Q03iDCay3jy1vlB2GamIIaNr CD9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6927-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b10-20020a50ccca000000b00553b5605926si898277edj.564.2023.12.20.05.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 05:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6927-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 612731F214A0 for ; Wed, 20 Dec 2023 13:00:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B234625559; Wed, 20 Dec 2023 13:00:30 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 417C425541; Wed, 20 Dec 2023 13:00:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98EAAC433C8; Wed, 20 Dec 2023 13:00:28 +0000 (UTC) Date: Wed, 20 Dec 2023 08:01:29 -0500 From: Steven Rostedt To: David Laight Cc: "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tzvetomir Stoyanov , Vincent Donnefort , "Kent Overstreet" Subject: Re: [PATCH v5 02/15] ring-buffer: Page size per ring buffer Message-ID: <20231220080129.3453bca8@gandalf.local.home> In-Reply-To: <84d3b41a72bd43dbb9d44921ef535c92@AcuMS.aculab.com> References: <20231219185414.474197117@goodmis.org> <20231219185628.009147038@goodmis.org> <84d3b41a72bd43dbb9d44921ef535c92@AcuMS.aculab.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 20 Dec 2023 08:48:02 +0000 David Laight wrote: > From: Steven Rostedt > > Sent: 19 December 2023 18:54 > > From: "Tzvetomir Stoyanov (VMware)" > > > > Currently the size of one sub buffer page is global for all buffers and > > it is hard coded to one system page. In order to introduce configurable > > ring buffer sub page size, the internal logic should be refactored to > > work with sub page size per ring buffer. > > > ... > > - nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE); > > + /* Default buffer page size - one system page */ > > + buffer->subbuf_size = PAGE_SIZE - BUF_PAGE_HDR_SIZE; > > + > > + /* Max payload is buffer page size - header (8bytes) */ > > + buffer->max_data_size = buffer->subbuf_size - (sizeof(u32) * 2); > > + > > + nr_pages = DIV_ROUND_UP(size, buffer->subbuf_size); > > While not new, does this really make any sense for systems with 64k pages? > Wouldn't it be better to have units of 4k? Unfortunately, it has to be PAGE_SIZE (and for now it's a power of 2 to make masking easy). It's used for splice and will also be used for memory mapping with user space. > > ... > > @@ -5102,14 +5110,14 @@ unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu) > > { > > /* > > * Earlier, this method returned > > - * BUF_PAGE_SIZE * buffer->nr_pages > > + * buffer->subbuf_size * buffer->nr_pages > > * Since the nr_pages field is now removed, we have converted this to > > * return the per cpu buffer value. > > Overenthusiastic global replace... Possibly, but the comment still applies, and should probably be removed, as it's rather old (2012). It's basically just saying that the size use to be calculated from buffer->nr_pages and now it's calculated by buffer->buffers[cpu]->nr_pages. I think I'll just add a patch to remove that comment. Thanks, -- Steve