Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1964871rdb; Tue, 20 Feb 2024 12:23:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX5QxFeuWqGuNAYS6SmziVf6rRyfsQmRGYAaNCF4kNtMaPuihDfqJeNuyZcZm8555Z3K2HXTsNv1t9f2n0AUCconrpi8epxOVhYt8tjTA== X-Google-Smtp-Source: AGHT+IETWhTbzET1YV1bPieUXfpPlO+Tg9DXj77F4SkAAEjOfw+zztB9dI6gnJFAfsq2r34YG/Xr X-Received: by 2002:a17:902:ce81:b0:1db:e244:78 with SMTP id f1-20020a170902ce8100b001dbe2440078mr11614534plg.20.1708460636242; Tue, 20 Feb 2024 12:23:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708460636; cv=pass; d=google.com; s=arc-20160816; b=UIjzTOrdYfUV7bp+cf38B9Ug8SkBmibDSFf6Yp9CbJNqmDhD0wM6t5jF6lcE29bgj1 8jD6DfhhUatqFolSaTU8ZJfCWKapleHsbs43q/AiUnPcexRsEBnBXeHSEsQ2e7Bak50R 7cA9QGJB74LRRG4Dk4ylH8g36D1X0WZWWkuEUR/aAppiC26Qfs9jX2P9BDXXLDqsm+2C jnMZYKtKsp0eLHJRQw4198ArZT539ZFzDZdTwJ8EBNUFlc3rQX8iSB8ITo7Ld4+g3W6w XLk58qVaJZgepThDFvuVuw3wC8QFRSArrCqYgWMSpSqXX6CDpLL3uHDhO8q2vGXD8IFG HUCA== 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=U2evzm3HI5GwNbxXWo5kB/PowbSsdEjz5X/q5vGufRc=; fh=y05Cwd1sxODzY4dmrZPTxcaUJthmK9YgzZk+WONK1EA=; b=t4eqaedALS8QIFh5j8NslJUDiO44gpSOE6Mrq7xyvsF357YjhTQ1AdWIwDgXPuLqMl txNNh7JbhlQdmtUqnIkmyCPemqyjW0VAoQJqWfoda6ZYeo01weJ2oxIenpqOKortHm1B hobpyTu/WXGBIZ15TT+nEM6XmnZD9/mlPHo/Fju5M20k4mng0e652O/Eg4QKO4mLI8Pv w+FgPka1fcs69qqYxJi5Nqeh/fncP3/mmR4lObgDDsWbpBtLmP29zWYiE9Nj9Mpck507 0JwLzajdcxTw3SOqkp9/4HFW1FFUBSPkj5Cswu0xV+zxRS8PD1XYYzRv7AT/iGeL73fz j7mQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XCe6XRjN; 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-73669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73669-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a19-20020a170902ee9300b001d9a51954b1si6549675pld.527.2024.02.20.12.23.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 12:23:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XCe6XRjN; 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-73669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73669-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DCA95B22496 for ; Tue, 20 Feb 2024 20:23:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3762714AD33; Tue, 20 Feb 2024 20:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XCe6XRjN" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 CE63814AD0F for ; Tue, 20 Feb 2024 20:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708460600; cv=none; b=EQsWRCNtroLJkTo/RLIImcmEWX2T7Mi0lHzfZLavbeePXV+x3xd0jIY/BmbsfCSWql6eltu1xeTLmOO0tEeUSwV2Se8aMeE3/CpQGUy4S5wuq33/8aVXPiNVjIfOF5bKq/yjczhhw02nlnySSsfrGFXAi4JGzKKhIBoUqdHcBgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708460600; c=relaxed/simple; bh=okSYdCoqtYalJqTVBXSYlec5NVTxMVA7/+jsV6YNCNE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oDtv/Utnrz4/ZeqeTFLDUFWwBcIoAwRLf8hO78IPNdBLOmM54xhojhVza7mC+rDNEgIqDKUNR82z4ItgOex9wHhzNTpHW842AoTE4JAwBYmNpk0qIJW0SqGk9aL7iX4mx1pETTRpL9jU1pd/RerbVSZ2tCJBXWy2cG1j/XAWZvk= 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=XCe6XRjN; arc=none smtp.client-ip=209.85.219.201 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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcd1779adbeso12442037276.3 for ; Tue, 20 Feb 2024 12:23:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708460597; x=1709065397; 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=U2evzm3HI5GwNbxXWo5kB/PowbSsdEjz5X/q5vGufRc=; b=XCe6XRjNKl6p6D+QtnVQ1fd7smNuNNF4gBbip7rGWdP1a9Zwnxyxrd1pYVihv84RY9 WabywR95mB+MegEgdXAnDXr68KTYX1cqytlQb7wrnLOLVGuu2kqszQpbhTqqn1cIP/gC d9Z72cSndzBGxmybUSkSBj0iZXd3pLfFhZ+Xqiyp2J9KCelQXOJymKmMr0PVBZdQsXHX b+WskpkM1w1+CPsfhPajAZux0PI+FhOhO1WHZDlJ4Z9XT6lMcHxmK6YShuJe9FiMvtA9 EzuHCIyvpCTAMSnwjSIA1xUEz5rxDYnp+tx2OeAoW0w8YrhqLeAjLOKa7TU+znrT/IcW pfrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708460597; x=1709065397; 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=U2evzm3HI5GwNbxXWo5kB/PowbSsdEjz5X/q5vGufRc=; b=qroMiefGuoWRTtVnmreksaTG46fR7a6n4wByKUHoHP1sGIdkLy9cetvbDm83b1lZTD bbEZyYWKquosXtgoNqwtc2GIuGyiOKN0NjSh59vjt791oNlMbiq9/AASMVMj7wMis7nq MKFrDjBDRKRRiKU1uOP8g4biu1Kz9eaT4zelF05CWwgEHcO9FEO2Zl2dqUny4EzeZ90T kM3i9uKyLLKeOEcmNaGYXZ4TGSForslqLuSEHHXmyc4VPPxAWYgzcWWZ4RYk0564o6pZ WF4KSZTCMa9yhO63ctaVryRik3YAqHv4KrhtcXOcYo/GzFMd/OUebNKgJq2uIc9a8yyO dfhQ== X-Forwarded-Encrypted: i=1; AJvYcCXES5ZfaEfFl6HDW/Z90u0LP6PVhMabas/OzbNyEGjZ7qKSMtkcThe89f8EofpUEUOJ1SSAco8PDYvlzBy+f+a9E1Kk+qr9wFZABDfX X-Gm-Message-State: AOJu0YyoypzcglBPROaFAAtu9ZYmdZLTHtRrGzV+JMQ5DT4wer+NhjcN ISXgfuZupUoj+yLP9xh5S2n7jbumgsxP97/IKTJOYbJ6g6BBXTTpkmUZM0EbUdfgudvf5/VUiHe tajbA3Q1QbfKF7K+26g== X-Received: from vdonnefort.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2eea]) (user=vdonnefort job=sendgmr) by 2002:a05:6902:2188:b0:dc7:6efe:1aab with SMTP id dl8-20020a056902218800b00dc76efe1aabmr4730294ybb.6.1708460597013; Tue, 20 Feb 2024 12:23:17 -0800 (PST) Date: Tue, 20 Feb 2024 20:23:05 +0000 In-Reply-To: <20240220202310.2489614-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: <20240220202310.2489614-1-vdonnefort@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240220202310.2489614-2-vdonnefort@google.com> Subject: [PATCH v18 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 Content-Type: text/plain; charset="UTF-8" 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); -- 2.44.0.rc0.258.g7320e95886-goog