From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 C61B03DDDD0 for ; Mon, 1 Jun 2026 15:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780328374; cv=none; b=Zu9/5HcWqeJck2VeXFD/2G3b8wX3aguPFA+daoNhKXvY/6bxOmqU1spJihn/3Akz9dSSaxLYSYZQUUAHoOLt52W6wmkIiuBH0+9gp+saXK9qQ0gL7YCdcC9O2etn72248J9chPJhQEYnbBig4KIj8JDO+0EK402gr3FXS3glhj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780328374; c=relaxed/simple; bh=ANdFDagE1FI9L4ciaaW1zLEpqNlIYVOqb5rOO66ytYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PzXQOZSM8LMHLYGIFc03+NwK4Lt0pr7se+F5aTsn9RENwpBUsX4B7orJK/xqNLCuVGvQWxdormSKfgoMyyR4YwLIqofNJuLXCKI8PNSRAMrMF6WBAiuF/r+1S1MF7JTnJdftML5HgaO/9tdwpiqcgNBVgYs6YVMNbopTd/UvIhk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hSoScG3e; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hSoScG3e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780328369; 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: in-reply-to:in-reply-to:references:references; bh=5rLOUc5HbPT/FYcWYXwCC9V4dfTGQw36C0sjysDza+o=; b=hSoScG3eaYrGvTWholTUME6WCEWwojeitJYaVaefhOC2KJtDt/Vm4ggV6jOZPC5oA2iXh6 RN9Rh2WL+TSKlEoWsEM580cV116dlEKKhKGDt3ZWFnLsXd7LP1HriXH1vnXU0ijPwjElcR j0hU0IWKDd+dCItYIxDVo1Zt6Yhhg6A= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-171-xxXPe-vyMRinj0o79rqR3w-1; Mon, 01 Jun 2026 11:39:26 -0400 X-MC-Unique: xxXPe-vyMRinj0o79rqR3w-1 X-Mimecast-MFC-AGG-ID: xxXPe-vyMRinj0o79rqR3w_1780328365 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 84C7C1956060; Mon, 1 Jun 2026 15:39:25 +0000 (UTC) Received: from fedora-pc.redhat.corp (headnet01.pony-001.prod.iad2.dc.redhat.com [10.2.32.101]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BACDA18004A3; Mon, 1 Jun 2026 15:39:23 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Steven Rostedt , Gabriele Monaco , linux-trace-kernel@vger.kernel.org Cc: Wen Yang , Nam Cao Subject: [PATCH v4 12/13] rv: Fix read_lock scope in per-task DA cleanup Date: Mon, 1 Jun 2026 17:38:39 +0200 Message-ID: <20260601153840.124372-13-gmonaco@redhat.com> In-Reply-To: <20260601153840.124372-1-gmonaco@redhat.com> References: <20260601153840.124372-1-gmonaco@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 The da_monitor_reset_all() function for per-task monitors takes tasklist_lock while iterating over tasks, then keeps it also while iterating over idle tasks (one per CPU). The latter is not necessary since the lock needs to guard only for_each_process_thread(). Use a scoped_guard for more compact syntax and adjust the scope only where the lock is necessary. Reviewed-by: Wen Yang Reviewed-by: Nam Cao Signed-off-by: Gabriele Monaco --- include/rv/da_monitor.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 34b8fba9e..08e5d0c59 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -334,12 +334,12 @@ static void __da_monitor_reset_all(void (*reset)(struct da_monitor *)) struct task_struct *g, *p; int cpu; - read_lock(&tasklist_lock); - for_each_process_thread(g, p) - reset(da_get_monitor(p)); + scoped_guard(read_lock, &tasklist_lock) { + for_each_process_thread(g, p) + reset(da_get_monitor(p)); + } for_each_present_cpu(cpu) reset(da_get_monitor(idle_task(cpu))); - read_unlock(&tasklist_lock); } static void da_monitor_reset_all(void) -- 2.54.0