From patchwork Mon Jan 22 07:36:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 189934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2416308dyb; Sun, 21 Jan 2024 23:37:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGD+vn6Z1egrHnTSDFBhIONEC352kMBMbexnCrC+QUh00PiB0BYszfCda9AHidbgTNNJmNl X-Received: by 2002:a2e:88d7:0:b0:2ce:232:43eb with SMTP id a23-20020a2e88d7000000b002ce023243ebmr1559614ljk.71.1705909037573; Sun, 21 Jan 2024 23:37:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909037; cv=pass; d=google.com; s=arc-20160816; b=s6zbADLQyLedBPXqFRSmemXYyPdiq+NgN5UmINi99W6X10+fGPFkmiLF93RtR+E2oS rKVdUgsAhAlYC7P1v+nS9htD4rRrC9Jw1wNmxmcCuFyNa9tLGIryuSLkjxum+mRCg30r u8qmCzl9rn33sDsqas7PddJctrw4AqtZ/uUqxsZUw0S4SRBPIJPx8vMhtbSi9Xw7U0UG 1cJ9tyVY1qGwVJmoO/tIdGD/HzeQxLzGzMTgYmv399Zb1aWuAiclVdfO1VnJN5KhyzxY JaHzT4fX6G/IMYa0I2iGc284S7QwheGjsAdWxJyzZKTuHCs3s2rRdpiqDYrRRBn7MWC4 JxLg== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=iZwrwM1Ad6JK2YvVtV430bcdms4CvfKkXJdWk7cX5TM=; fh=f765siGvk1wIwX+Sf3VHfbQIJ+SsKu5JHQoQNRKp6x0=; b=ThTneoBuh+LWbE/OQfV/JIFtOY5FAI9t+XnJAJzp8vDq9Ku5mH9PuRSDmv/MYDpjop MkxjkViY7ati7nI/lzze+g23h6xhwJPzft1U22VKdlbiBmERFFKP7A9iUwwR5uYK3bx5 WEyxX9yDmgwroBERTdaDjqmwbA7ZxAAu3fN0S442aOFplImFNZBVUH0vz2tPNjJ0pUwe lMa4fWJ1qL43JpdppL2AVBZCYfi2tdorL3AQF11aXW+HLb0A18lY2LdsFzM2AjBwlYx5 YWtLagT1Vlj8zIvsw8Dkyv7TZs4IBmBu8W7CJ+mETbtbqLQy4VfrIcgnTwBRrLLzP1/R awjw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Wjt+AKpC; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-32432-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32432-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q24-20020aa7d458000000b0055a7295b32esi2994872edr.514.2024.01.21.23.37.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32432-ouuuleilei=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; dkim=pass header.i=@linux.dev header.s=key1 header.b=Wjt+AKpC; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-32432-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32432-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 2C55F1F227F0 for ; Mon, 22 Jan 2024 07:37:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06AA417554; Mon, 22 Jan 2024 07:37:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Wjt+AKpC" Received: from out-184.mta1.migadu.com (out-184.mta1.migadu.com [95.215.58.184]) (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 2C226111BB for ; Mon, 22 Jan 2024 07:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909020; cv=none; b=CiUMWtPC/NBE2cnzkq2JbXShRHm0Nk1TnIrIg20Q6dU+ZJxA3TVzdO+8NisJSmuL4g/sAwqOWADL7/BLs5x2mj6goJCLnAwyw5p7cvmbQVoP+a8ScSyMOiLPFb9lv12RrwmLMSHK95I3e18RMpuTB7gEVWCJKmNcdyXINz0fJ1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909020; c=relaxed/simple; bh=qy6klsxZk7hzsrK1qWptWRv9/t7/Mr89X7/6RjG3elI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=l/fQaff6nEDK5X5UmeTAL5vnFG1tjvhDRl7WWeMGEhKbLNsPvQK6beqJGT2a4H55SZJ2HE0d7x8rVoieSs2S4pVjHaRawWPEBmXeiDhX4B3APPBMR43b3oMKVjMJ9AGaRBwuaYnQ9M+bphYVHRJm5CEeonqKE7ACcqNXv1vb4LI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Wjt+AKpC; arc=none smtp.client-ip=95.215.58.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705909016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iZwrwM1Ad6JK2YvVtV430bcdms4CvfKkXJdWk7cX5TM=; b=Wjt+AKpC8WI7NsljxAg7ANsxEuGl2dxMVtAUBQqPqYa0o7QYCjGdDEh4IJLnXaHzNCg17D 5nMI2QS71LvrwZiDlCleENlxlGptuL5nTPGVrtxOk6n1xK+GkoInPZt3N3SgZo4nAbmY9R ZpSqKD9/4B/jPEoSLlxZvSdAm070AuQ= From: George Guo To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton Cc: George Guo , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] percpu: improve percpu_alloc_percpu_fail event trace Date: Mon, 22 Jan 2024 15:36:29 +0800 Message-Id: <20240122073629.2594271-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788775274620748862 X-GMAIL-MSGID: 1788775274620748862 From: George Guo Add do_warn, warn_limit fields to the output of the percpu_alloc_percpu_fail ftrace event. This is required to percpu_alloc failed with no warning showing. Signed-off-by: George Guo --- include/trace/events/percpu.h | 22 ++++++++++++++-------- mm/percpu.c | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/trace/events/percpu.h b/include/trace/events/percpu.h index 5b8211ca8950..c5f412e84bb8 100644 --- a/include/trace/events/percpu.h +++ b/include/trace/events/percpu.h @@ -75,15 +75,18 @@ TRACE_EVENT(percpu_free_percpu, TRACE_EVENT(percpu_alloc_percpu_fail, - TP_PROTO(bool reserved, bool is_atomic, size_t size, size_t align), + TP_PROTO(bool reserved, bool is_atomic, size_t size, size_t align, + bool do_warn, int warn_limit), - TP_ARGS(reserved, is_atomic, size, align), + TP_ARGS(reserved, is_atomic, size, align, do_warn, warn_limit), TP_STRUCT__entry( - __field( bool, reserved ) - __field( bool, is_atomic ) - __field( size_t, size ) - __field( size_t, align ) + __field(bool, reserved) + __field(bool, is_atomic) + __field(size_t, size) + __field(size_t, align) + __field(bool, do_warn) + __field(int, warn_limit) ), TP_fast_assign( @@ -91,11 +94,14 @@ TRACE_EVENT(percpu_alloc_percpu_fail, __entry->is_atomic = is_atomic; __entry->size = size; __entry->align = align; + __entry->do_warn = do_warn; + __entry->warn_limit = warn_limit; ), - TP_printk("reserved=%d is_atomic=%d size=%zu align=%zu", + TP_printk("reserved=%d is_atomic=%d size=%zu align=%zu do_warn=%d, warn_limit=%d", __entry->reserved, __entry->is_atomic, - __entry->size, __entry->align) + __entry->size, __entry->align, + __entry->do_warn, __entry->warn_limit) ); TRACE_EVENT(percpu_create_chunk, diff --git a/mm/percpu.c b/mm/percpu.c index 4e11fc1e6def..ac5b48268c99 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1886,7 +1886,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, fail_unlock: spin_unlock_irqrestore(&pcpu_lock, flags); fail: - trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align); + trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align, do_warn, warn_limit); if (do_warn && warn_limit) { pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",