From patchwork Wed Feb 21 14:08:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 204230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1059206dyc; Wed, 21 Feb 2024 06:10:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVt2IelPxGni4LCs1w0J2SZq0tKNyNUfJsaFC2CvKseZKZlNw8U+ghHPzn/SR1YrNs9uJUSoQvW+XcYSLokjqdmgHOePg== X-Google-Smtp-Source: AGHT+IFNC4PLJrjvKa1jv9e2RDYyt0RL5zFw0ayBo/1ta849qIyJQoq8gSCzF9Qh/WxZ2t3TMUFT X-Received: by 2002:a17:902:f78c:b0:1db:7c5e:f07c with SMTP id q12-20020a170902f78c00b001db7c5ef07cmr13092508pln.66.1708524651572; Wed, 21 Feb 2024 06:10:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708524651; cv=pass; d=google.com; s=arc-20160816; b=zM35UZDKHWwbLhYemrVESMKjne3Ew9jOgVtcWizLsts+PB75Q3N3uCqGzKcn6SJyOa OohdorpmdtZAp/5550MT6cvLJccYBfu0UHHfrDyauDJj4mXAPMhzTB+C/DxS/+yDjURU wb51eBWwMHhxsLfYdL1paY6Cb2MHUUh9J8OvUEGggVW2dh7axZXCzCSPe8bcjkDhhtxv 67L4gzn4ILFxYcDqrXeyBjBouC9EqL9B1BMkrQKA92xw5Ab/TKEhhcWZG1riS9rhYGY8 IG4hmbLJOuGfnD9cu9xN2ey9ENnFQ4MuiKiE0Myzosb2jEChdQ0g37Sy6+4ba/WdzD5o HXbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=xGHu2V5qqvE/Py6mmxOfHmq4EX9irfD6nbMLLs6gRQQ=; fh=5BBsyHlB8a39iZRylNlRwq68Y8N1HTURv9NhE+MQefE=; b=Z1Uk8nh06kLmE1R5rXZBRIt20JJxBd34rvY0qyLpyjDsyABC8inMhPzLAiRukGIFJS YQ48CbSFWpCmZAUQTZ/onVN9iztWkSDnNsIHJZuf+++J/MeHlU9fJ9REECK3ofQpoKSr gyLT9KqWy3UxlAyecjN51Pocrid3t7GjnvRwQpRQqnnBHDTViIvKfk1LKpAAeYOv6dA1 AU8dhkaUersRz47qluXFzBYTUgIGUAgN0tWozPK1reKLk5lAIGwwDxej13IywqeducAF D05t+DnUr53fcAQsyJHHtQLZ5K+moPPP0duJxUfxsEM7Nt5L7Z9HkAvs2q2O7wot4NxR YKFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-74861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74861-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e5-20020a170902b78500b001d93b748a55si8029649pls.25.2024.02.21.06.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 06:10:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-74861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74861-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 95347285919 for ; Wed, 21 Feb 2024 14:10:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDE3B80C18; Wed, 21 Feb 2024 14:06:43 +0000 (UTC) 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 E3ACE7F7FC for ; Wed, 21 Feb 2024 14:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708524400; cv=none; b=a4njMEfY0UIcz79nzxWfFUq6ec0AXv04f9xeNDz5DRnVaJxNhLpjMd6RkgmSqrcGb/GGVdk6FoGgtVVHyXflPg41DWDYaK0aZ1KrvWMAvdoNuItTYL+kDGpizLkHo/pl941seUlOnEvhzVX/U2QKcB/O/IjheSudIb1fsAFiZDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708524400; c=relaxed/simple; bh=kD7M7W5im/QqyD+BL+StSePiG4RjxVtgbKA8LCF5L70=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ZYa2B0jqB5eXb6uU2XP9JNZl7V8D7UvAmlodLkf8xgj3W9rhpJDQs+5k9yU9GLotZgSyBRjNLGUzyFRIlTrbjus7GQivj70w6dXNIJ9gqjGqtlBqNSq0RuHJs0O0/0IuG39tN84xEQNwCOmnvstdEWnYbmzKWPX73AhYpNpHOqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C48A9C43609; Wed, 21 Feb 2024 14:06:40 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rcnGu-00000002i9q-43P5; Wed, 21 Feb 2024 09:08:28 -0500 Message-ID: <20240221140828.828440398@goodmis.org> User-Agent: quilt/0.67 Date: Wed, 21 Feb 2024 09:08:02 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Vincent Donnefort Subject: [for-next][PATCH 06/11] ring-buffer: Zero ring-buffer sub-buffers References: <20240221140756.797572998@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791517945364765638 X-GMAIL-MSGID: 1791517945364765638 From: Vincent Donnefort In preparation for the ring-buffer memory mapping where each subbuf will be accessible to user-space, zero all the page allocations. Link: https://lore.kernel.org/linux-trace-kernel/20240220202310.2489614-2-vdonnefort@google.com Signed-off-by: Vincent Donnefort Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ring_buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index fd4bfe3ecf01..ca796675c0a1 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1472,7 +1472,8 @@ static int __rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer, list_add(&bpage->list, pages); - page = alloc_pages_node(cpu_to_node(cpu_buffer->cpu), mflags, + page = alloc_pages_node(cpu_to_node(cpu_buffer->cpu), + mflags | __GFP_ZERO, cpu_buffer->buffer->subbuf_order); if (!page) goto free_pages; @@ -1557,7 +1558,8 @@ rb_allocate_cpu_buffer(struct trace_buffer *buffer, long nr_pages, int cpu) cpu_buffer->reader_page = bpage; - page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, cpu_buffer->buffer->subbuf_order); + page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_ZERO, + cpu_buffer->buffer->subbuf_order); if (!page) goto fail_free_reader; bpage->page = page_address(page); @@ -5525,7 +5527,8 @@ ring_buffer_alloc_read_page(struct trace_buffer *buffer, int cpu) if (bpage->data) goto out; - page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_NORETRY, + page = alloc_pages_node(cpu_to_node(cpu), + GFP_KERNEL | __GFP_NORETRY | __GFP_ZERO, cpu_buffer->buffer->subbuf_order); if (!page) { kfree(bpage);