From patchwork Tue Feb 13 11:49:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Donnefort X-Patchwork-Id: 200400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp479849dyb; Tue, 13 Feb 2024 03:51:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU7607YkLSufL7k6iGeq3Yj72oE9cqLH7+3SaAFz2LZay87xJ0VvXgz4AZRUzBi/2ITjmJBs49macIyhJkNOLCnWNCskw== X-Google-Smtp-Source: AGHT+IEmD7EI/aYjyP0q9LY+z8AUlyCqgtuLIAhGxP5Vib33nrZt0RsTp2lYHxLmcuxOii+6a+Wd X-Received: by 2002:ac8:5d47:0:b0:42c:792f:30ed with SMTP id g7-20020ac85d47000000b0042c792f30edmr4257748qtx.20.1707825080160; Tue, 13 Feb 2024 03:51:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707825080; cv=pass; d=google.com; s=arc-20160816; b=MvPKayK70+HvOhTCBDOSAlcIw7EyrCaR5rr5ELyRzrIqHHJn0xgx4FfF5z8NZ0yuX2 YyUqW2NaDSWcKlR4iAP34qBv8t9IydJ3A8E7bZg1TnUvF/M/1mn0osrTlRC99G8lSdkp e9An+UqCUVqm5ANuft5FoWHGHR+NVi6DdsxXBHxTZfeyxd3OYizh7oCgAYzPcOThoc0J TEIXe3KvOQYq+J+ot8fpEMzEuixB+xRpYpKlTDODa4aluBQvJNU3UkAOn1cCD87nUkDa b0Xg+YyUC/JtXuFMdfUofofcTfsl7LQEVLSTGSor73ct4jxZHvuOTDmyMYHm361Z5JWc EiQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=SqiLbHub5ruL/UvpG5IMav/eAn4s+2aSSt9gMa9+oOE=; fh=CdEgoSIT52O92jl9WqCt2Y8VLHiFXI2olb6kd+yO5wY=; b=HT8loKaqW8t9hpRDmrCViKqUS9H1IcnmiZW58qBk/IMXi+WPqWAbNJ/PqWC4adm3Al cZoxukHu5GbVCwZwJLvhvwiH28IeyB/q0J0NGdMfvoi47vAdcPaLNLey2wHZxVxR+5t+ kjkuUfU+HEYhwfaUPbILTqltKGFJoV4So93Db6hYD7AIYwd+6g+Wr7Js1tWEALcFnhwN 0QrQaoHLnzhzOH9nfGdjHJ8CPVX2QTKRWEys4DGirYD8GRUOPhAFlED5KVGrVHnJg1eP m2lvTEmskBNpHzotjo+EaHPXNOT1OlmNspeRcYc0IQIJ22I0JQPxS0rU4FcLhU+1vA0p RFYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JgoP3yg5; arc=pass (i=1 spf=pass spfdomain=flex--vdonnefort.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-63460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCWUThsCrANkxewBw2n9Z95hWR+MOdqYJplooby8K6lmx1Ys+DU5sloMGdodjGMvvZxlu7MdKY3x7OfputsjGb/udAla5Q== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h14-20020ac8548e000000b0042c513c8cc8si2470844qtq.68.2024.02.13.03.51.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 03:51:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JgoP3yg5; arc=pass (i=1 spf=pass spfdomain=flex--vdonnefort.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-63460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EEE181C22420 for ; Tue, 13 Feb 2024 11:51:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAF163B19E; Tue, 13 Feb 2024 11:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JgoP3yg5" Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94CFB3838B for ; Tue, 13 Feb 2024 11:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707825054; cv=none; b=AGm0n2wZjZkZ6yrmui+UFP27xc2T78CON965MIH+QPEbc5terr4LTZ9FbGETJyfbu7t8tJKaZJg9qVNR+JlQXfB8zMxWDK4WFYzf2cCB3e2uHxjO+hoEJiYApw9Zg6mfhJ0Kp2ZfNBcJNAVbkDHOGC77DdVDcaHnxomb9qSMmfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707825054; c=relaxed/simple; bh=tpt51FeO44HeEXQqmygp1fYLZoXSRZvsHL381MrJybw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gwjZ5Pp1Z5PUPK58ishlsnXRLS9IztRlb47F2kxA0xojvdZRGf9MNn0u74G2LZUqm2l9fsBJVQgybbOw1kFlvnGdzjlNqgjWKip4xMGtorw2cUSs5hCyYdgTbCBMzK+PiupW/4s/tcL6MSGzmBjHZ48gwc/wtmImhVgWXUDO9jo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JgoP3yg5; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-33b51ae1c9dso2299339f8f.3 for ; Tue, 13 Feb 2024 03:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707825051; x=1708429851; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SqiLbHub5ruL/UvpG5IMav/eAn4s+2aSSt9gMa9+oOE=; b=JgoP3yg5iG8LtWaqhHNt8bZLlN8i/E3BVPIbeGkuCCyJZzZiC32UsgdHN3e1QTie2p Ised2wICTdhGtRwkLH5gDbZwF80nYi4pfMDU+m6bWLgMmIupyGuSRH3ArM8XdXov/t0j 5Db2QoUwRg5wIB0zRD3v5V0QTIpaYHGQ53YHgZ3kv6Gr/nS+RlMoJlhqkC5dXlndU0sm CjJLEd9ZuICjjAJOfuAnDYdeuLUFcJi6/RttxGHmBXmervtxjDOg2eWm20rEU+mvClD+ QUoWXEdTFS0aFaVCOp0RItDZblwaKOir0i1W6Q21hDtwdpEwz8FlaDqmaBsJgU3uWqfZ 46gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707825051; x=1708429851; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SqiLbHub5ruL/UvpG5IMav/eAn4s+2aSSt9gMa9+oOE=; b=RD3X/FD09RjJJJbyRdNtUz1PkzUaNYjA2U6b8iAoxgT4kWhc1qTA4xgRznF1zkK1fp 9dxNag1HRnqNuUgkVUARt6ispGLz7luFSzHcTdRtWG1uthYfgScnALKDq7DW/fRn57KD K5GMrn7RxfBTz7Bnps7EiXCnl0CJgDVABFhms2i2SQmtaUdqANuFrS7Sxzg8+HGEJez+ hHAZvl3So+DIhjHbp1qDItb1lCNxfj1BFzK6KNqH6w3e0uiIUPYsWDbA68oImkZalFP9 Oh4efDFctbJLsqCHvgQD0EbmsXT2CIYFHTy8u+6UUwdus/b80I15JqJN1ooPoDUem9Wt g2Ng== X-Forwarded-Encrypted: i=1; AJvYcCXmk/XhythEkujCBfYWk2ncAQ43vmi0nDvarXWSAQ/cdZdniOApGeZvAQIDGnXKWklMOZuhQG+dDEHmtGjwKAaGfggejXzEJEsF2XK/ X-Gm-Message-State: AOJu0YwAMQzdbhOM8RU+h/vNc1Jsox7kCxP7RUDum7tfZIWw9A40PY0i RbJDKXTLEd+Yf/k3H7/voeW49SPSZOI4aNdDiorvMdhB//n3PgakkHDKn00WAjib251Nhwnqrfh viUE/iYgIoiV83XMGDg== X-Received: from vdonnefort.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2eea]) (user=vdonnefort job=sendgmr) by 2002:a05:6000:1d8e:b0:33b:7599:8e89 with SMTP id bk14-20020a0560001d8e00b0033b75998e89mr21949wrb.6.1707825050625; Tue, 13 Feb 2024 03:50:50 -0800 (PST) Date: Tue, 13 Feb 2024 11:49:40 +0000 In-Reply-To: <20240213114945.3528801-1-vdonnefort@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240213114945.3528801-1-vdonnefort@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240213114945.3528801-2-vdonnefort@google.com> Subject: [PATCH v17 1/6] ring-buffer: Zero ring-buffer sub-buffers From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: mathieu.desnoyers@efficios.com, kernel-team@android.com, Vincent Donnefort X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790784391213345829 X-GMAIL-MSGID: 1790784391213345829 In preparation for the ring-buffer memory mapping where each subbuf will be accessible to user-space, zero all the page allocations. Signed-off-by: Vincent Donnefort Reviewed-by: Masami Hiramatsu (Google) 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);