mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Huafei <lihuafei1@huawei.com>
To: <tglx@linutronix.de>, <peterz@infradead.org>
Cc: <akpm@linux-foundation.org>, <linux@weissschuh.net>,
	<song@kernel.org>, <dianders@chromium.org>,
	<j.granados@samsung.com>, <liusong@linux.alibaba.com>,
	<lizhe.67@bytedance.com>, <yaoma@linux.alibaba.com>,
	<dzickus@redhat.com>, <mingo@kernel.org>,
	<linux-kernel@vger.kernel.org>, <lihuafei1@huawei.com>
Subject: [PATCH v4 -next 2/2] watchdog/hardlockup/perf: Warn if watchdog_ev is overwritten
Date: Sat, 14 Sep 2024 01:39:41 +0800	[thread overview]
Message-ID: <20240913173941.2758596-2-lihuafei1@huawei.com> (raw)
In-Reply-To: <20240913173941.2758596-1-lihuafei1@huawei.com>

When we create a new perf_event, it should not happen that the old
perf_event is not released. If it does, make a warning to sense the
problem in time.

Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 kernel/watchdog_perf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/watchdog_perf.c b/kernel/watchdog_perf.c
index 2fdb96eaf493..09236586b8c3 100644
--- a/kernel/watchdog_perf.c
+++ b/kernel/watchdog_perf.c
@@ -144,6 +144,7 @@ static int hardlockup_detector_event_create(void)
 			 PTR_ERR(evt));
 		return PTR_ERR(evt);
 	}
+	WARN_ON(this_cpu_read(watchdog_ev));
 	this_cpu_write(watchdog_ev, evt);
 	return 0;
 }
-- 
2.25.1


      parent reply	other threads:[~2024-09-13  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 17:39 [PATCH v4 -next 1/2] watchdog/hardlockup/perf: Fix perf_event memory leak Li Huafei
2024-09-13  9:42 ` Li Huafei
2024-09-13 17:39 ` Li Huafei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240913173941.2758596-2-lihuafei1@huawei.com \
    --to=lihuafei1@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dianders@chromium.org \
    --cc=dzickus@redhat.com \
    --cc=j.granados@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=liusong@linux.alibaba.com \
    --cc=lizhe.67@bytedance.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=song@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yaoma@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®