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 283AB37AA8C for ; Sat, 30 May 2026 14:17:42 +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=1780150663; cv=none; b=GfV3TUJ9qG2J7ysOjv/6A2Tl8R+Rf+D+wiXqhLYoWBZZncUoIwyANAbMPUdKyAYxQuDTDjsE7y7/Q7GE/jpHlO2HwsAsCui7DCCyuMgUA4unHinSYst864VSfHKv2Xa/SunlSaGhFETOVsXNEgcD+Pq3BRb+CzK80vTofYoCMmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780150663; c=relaxed/simple; bh=VUpfsFc62bFNBVbMzaTza0SKHhnDqyPiMbii4gCBqEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oe8PjnlTwoqvUpDxdillpVon+SpxFnWr8SbDpeMRldB8rnZFe/z53pW8RfdlkwQUxi7+/BqMlsYtSmfwX92EpVdgfW3TKcV2YRORroMtW9j7aUVzgA9mYYOvNv0JLXS427ompmRqaCzmBi1J3s+L/jYIdg3cLQE+dk4W1CVK34g= 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=RlmYtgPO; 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="RlmYtgPO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780150661; 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=PNimF1QAk1+ATYYd1bb8YN+Y+pOQsQfgOs4cRpBAAPE=; b=RlmYtgPOHBQvG1o8uZhN4D3DI9KWm2Zxkxj5roR9rLAoRXySfGAzXRPQpQvz/h5R0Wh1ha i4aVouJezNGxLelTyshNiC3qlwJ1hhQc5YTfTZyxQoWGW31tSnZIHkW12YCIZ3chilyRqd sZiH3d3W14P0WCsc5eGvD23h51y307I= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-KZjYUwxRPcSiLEqG-k0dmg-1; Sat, 30 May 2026 10:17:36 -0400 X-MC-Unique: KZjYUwxRPcSiLEqG-k0dmg-1 X-Mimecast-MFC-AGG-ID: KZjYUwxRPcSiLEqG-k0dmg_1780150655 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6BA29180044D; Sat, 30 May 2026 14:17:35 +0000 (UTC) Received: from fedora-pc.redhat.corp (headnet01.pony-001.prod.iad2.dc.redhat.com [10.2.32.101]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9335D30001BB; Sat, 30 May 2026 14:17:33 +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 v3 12/13] rv: Fix read_lock scope in per-task DA cleanup Date: Sat, 30 May 2026 16:16:51 +0200 Message-ID: <20260530141652.58084-13-gmonaco@redhat.com> In-Reply-To: <20260530141652.58084-1-gmonaco@redhat.com> References: <20260530141652.58084-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.4 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 ae8c35fcb..f4fc22cac 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -294,12 +294,12 @@ static void da_monitor_reset_all(void) struct task_struct *g, *p; int cpu; - read_lock(&tasklist_lock); - for_each_process_thread(g, p) - da_monitor_reset(da_get_monitor(p)); + scoped_guard(read_lock, &tasklist_lock) { + for_each_process_thread(g, p) + da_monitor_reset(da_get_monitor(p)); + } for_each_present_cpu(cpu) da_monitor_reset(da_get_monitor(idle_task(cpu))); - read_unlock(&tasklist_lock); } /* -- 2.54.0