From patchwork Thu Jan 11 16:17:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Donnefort X-Patchwork-Id: 187436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1559375dyi; Thu, 11 Jan 2024 08:19:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGm04U0ruOCy8sJQvGCmSQJeu4CoRVA83tCAMWCeW7X/d0LRHt1D3zTfLTBUZ7VqLQBBl9f X-Received: by 2002:ac8:5c88:0:b0:429:a053:e0a1 with SMTP id r8-20020ac85c88000000b00429a053e0a1mr1260528qta.16.1704989940139; Thu, 11 Jan 2024 08:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704989940; cv=none; d=google.com; s=arc-20160816; b=zk0P/tqcb3L3MW1cH/E8DudmbrnTBgkjPt4E/SbCRdjzy/gs83n8QdM5n6qAeyGANn Z2PvPF+GA6awwIckb9BmKnqpu6H346vxG3ZTuH61aJ4i1vDPEfFE7J/U1TzV6u7rE3SG loHYsXGG9Vzd6+/x+9WSG+hSLpxi4J7ptyGryVBiWSdKoOKeT2RsOi6Z2uD1Baox4xWu UHiad0yH7eCr4y8U3fWQMC2bU7LA4AqPQrLuS3lSdXY/r7VVbURf1VihEZNwxE4a5f0j +UGxoTXXstZdVnMrSLw+PL/aKtghyL86LCcdyQBkYIUPCY8hf/da8NT28ZceZ4LeuhQw MoGA== ARC-Message-Signature: i=1; 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=urOae5rhFO+lmkwawv/vVpYhVX+PQ6+XyZK8aXYOwuU=; fh=Osewoyidmyt6GUNpr1HkxMO6OLm/aX24FkE9kqTXAtA=; b=gBk8lWec+gY/MNoH4xJkowWFpFDLPzSUY01+uB6KHHcKExaghsWy/PUZ7a6ZoKMdGI ejiyGiXp1Ht4l0Rx3o2ySvRjbf2HxUce62VCKbGXo/MewkdGvjVpHfu+RTcSNtJwaQjO 4LKEoCbqgoC6xlsPsVj2MDNZGxj6aEOWiyjKTmDj9MOEuzpwbelXGFQ5fufeQ1lJ/rHS 83qe4unuXWWJ07NeMdLbzUqG6JFUFw673k2djnIXOpVjYkDVBbSiADvpUDkkppgWKApu w6H75PVVfrkrB9vDaa40QZ3AnIfVu7SYAuG+UlQ9xxdWJWCBNM0JH0mph/uOC2ou1a6M DsSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="K0lnm9+/"; spf=pass (google.com: domain of linux-kernel+bounces-23843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23843-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s8-20020a05622a178800b004299d7d03adsi1246162qtk.339.2024.01.11.08.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:19:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="K0lnm9+/"; spf=pass (google.com: domain of linux-kernel+bounces-23843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23843-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 E895C1C23242 for ; Thu, 11 Jan 2024 16:18:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 668F552F78; Thu, 11 Jan 2024 16:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="K0lnm9+/" Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.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 DBDAF50241 for ; Thu, 11 Jan 2024 16:17:23 +0000 (UTC) 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-wm1-f74.google.com with SMTP id 5b1f17b1804b1-40e4caa37f5so26392185e9.0 for ; Thu, 11 Jan 2024 08:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704989842; x=1705594642; 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=urOae5rhFO+lmkwawv/vVpYhVX+PQ6+XyZK8aXYOwuU=; b=K0lnm9+/Oin3Bl9s7WIjjMeZoohAvkHXeGcXPjXRRpLtmbSdpKMlCPUIrdLen9q1tx Xok7zLWfWGECmITMmsZlH2RWJU4phaXF/mXq+sni2IqMbNUwpF8y0glmojJ0a39PMyjo X+Zja6GZVrRdxVF2mvB7l1rzdR4ESOjt0+gC4vGq5MeCl6BMTAOEn2nVmOyLQWllmOQ7 /Z+N2snbfFtgqwanuC0akjvAI2Y1kKI7cLAfTXgCWZyuCXTJIQag+XVUHQqqUphjG1Dv msliKn0Zsth/LnMX+yD/AwpocbbOjY98yixE+nVnZy5gkkPEKuMt1fsCaQ/r2jUhpFVx rMeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704989842; x=1705594642; 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=urOae5rhFO+lmkwawv/vVpYhVX+PQ6+XyZK8aXYOwuU=; b=xJIUWpRqy6qqf40TM5HFx0/LjFsON7lQB83sPbVKI1zhgj2GClUG+a43O/1sPE+wEe jot2wQvrGhPvP5AgM9ZAPTESvqF+AjIKbzodurc1SN/IetAKJncms7TAad2FmQu5NAUs zP+mMgHhDiihOi4pvr0oQR+kQJ7e1zkXU8s6c88SERq3pwGoKaUZalgklksNoDBJYOem A5RcZCgb77P5gUVg3P1RQy+32tA1Z5uq0zvDfkWxjEbj65sGbmbGfrUPnEro5yu/G/DB 02qRUMbVkE8WUJ0Sfxf/JZS4zY+qoCDoVL5gMUTWCsTE1w1NO03sir68aHDFOmwAt8pZ rwPQ== X-Gm-Message-State: AOJu0Ywj//pLFHj2gOBNO9HdEnWPstPpUl4QX8T+DrbhuO95l/OOqiDX z50VU3WE7lDSIpxoX5Tsi3uuRlxegLSRM/AkiC0BNI8= X-Received: from vdonnefort.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2eea]) (user=vdonnefort job=sendgmr) by 2002:a05:600c:3b0c:b0:40d:5e86:fe9e with SMTP id m12-20020a05600c3b0c00b0040d5e86fe9emr173wms.5.1704989841944; Thu, 11 Jan 2024 08:17:21 -0800 (PST) Date: Thu, 11 Jan 2024 16:17:08 +0000 In-Reply-To: <20240111161712.1480333-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: <20240111161712.1480333-1-vdonnefort@google.com> X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog Message-ID: <20240111161712.1480333-2-vdonnefort@google.com> Subject: [PATCH v11 1/5] 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: 1787811531521434552 X-GMAIL-MSGID: 1787811531521434552 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 173d2595ce2d..db73e326fa04 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1466,7 +1466,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; @@ -1551,7 +1552,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);