From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id q6tfBW7hqmrHUhMAWB0awg (envelope-from ) for ; Wed, 16 Sep 2026 14:35:26 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=dkaBe6U8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E7F651E01F; Wed, 16 Sep 2026 14:35:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 06B971E01F for ; Wed, 16 Sep 2026 14:35:24 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 292474BA7993 for ; Wed, 16 Sep 2026 18:35:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 292474BA7993 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=dkaBe6U8 Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id E9AC04BA2E2F for ; Wed, 16 Sep 2026 18:34:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E9AC04BA2E2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E9AC04BA2E2F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789583690; cv=none; b=PdaJfRiSVQC9tm8gV3uM8dRIR8JwEUZ2yqDtFQbt3TrkzjAHl/8G1YELRNKmbfh0p4Q5vURi3hLwkLd3iKtrC4wYILPTTtBbjpgNHT4MO88Duh3iTFaWJf+w+3w5y4Crj5M9SAB6jz/crmF3gt8DaaOk+6f2of7yJKpBHeYcbFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789583690; c=relaxed/simple; bh=XfUNpuKAiI6jKik4NKmTEtEC791LYBca8SOsMgBxpkI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=f6cj4K/x9Q/PAoYPaoGshL/CqCK38TovSQp1koWqQpDVPCWJwG2Kt7WpMw1uVlI/lm7Qo/JorsD3WSfVqP5/kChm8cZxnZ9m78rtzwlkJBfW3ruO7uDSTdK82wj2J1LqcS7ZJ1zhQzalij44ni0vkzsCOulEw3DzIISUX+EmOvI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=dkaBe6U8 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9AC04BA2E2F Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 68GIYd1j237932 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Sep 2026 14:34:44 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 68GIYd1j237932 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1789583686; bh=Drwrez/ySoy3DJAwFogHFkSPVLh0nmlqtavPlsIO+pA=; h=Date:Subject:To:Cc:From:In-Reply-To:From; b=dkaBe6U8w9bKlcEVYlGcVVJ0mVs5Xm3PeHVvSKsnZzzW/S+ivCvUWnhxEF85yyBKP kg09uM59oOlk6Z8Jtl6FcTT50ZnlNmse7okbGzt4IGXX5xl4ZEsXO93YNYxzugL2rV IoNjESyuCUQcUd6mSal+Njc8XdEodRh4YZGFaGFsY5xLZwvXxdmwf6tVH4e2v89Mg8 Rt8oeX+Yl7dIl03PJatjjiHrw9RGdxm3KUthLpp4nE0g2jKV3Hj3BgfAGV6LUgF7PZ L7dXGVf+5fWSqDutRiMQjtY4guNX05xb21XR0B3zQn8xBsgSd/E4CfcUw+FOqbpAkv N7rRJMs8UXHSQ== Received: by simark.ca (Postfix) id DBBC41E01F; Wed, 16 Sep 2026 14:34:38 -0400 (EDT) Message-ID: Date: Wed, 16 Sep 2026 14:34:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3][RFC] Batch getthrds() calls in get_signaled_thread To: Aditya Vidyadhar Kamath , ulrich.weigand@de.ibm.com, tom@tromey.com Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com, sangamesh.swamy@in.ibm.com References: <20260916114603.17488-4-akamath996@gmail.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260916114603.17488-4-akamath996@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 16 Sep 2026 18:34:40 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-09-16 07:46, Aditya Vidyadhar Kamath wrote: > From: Aditya Vidyadhar Kamath > > The original code called getthrds() with a count of 1, fetching one > kernel thread descriptor per syscall. With N threads in the process > that costs N syscalls per stop just to find the signaled thread. > > Change to fetch GETTHRDS_BATCH (64) descriptors per call and scan > the batch in a loop. This reduces the syscall count from O(N) to > O(N/64). > > Also done the benchmark here who results are pasted below. To analyse > where time is being spent. For now, this patch request for comment/draft and will > remove the same and this paragraph from the commit message after > feedback. > > ========== > Benchmark C code > // cat ../bench_next.c > /* Spawns NUM_THREADS worker threads that spin, then steps through > 10 assignments in do_steps() so GDB can time each next. > > Also tests two scenarios from the bug report: > 1. "next" over a call that spawns a thread (spawn_thread_here()). > 2. A background thread exits while "next" is in progress > (exit_thread_here()). */ > #include > #include > #include > #include > > #ifndef NUM_THREADS > #define NUM_THREADS 3 > #endif > > static volatile int keep_running = 1; > static volatile int extra_thread_started = 0; > > static void * > worker (void *arg) > { > while (keep_running) > sched_yield (); > return NULL; > } > > /* Thread that exits on its own after signalling it has started. */ > static void * > short_lived (void *arg) > { > extra_thread_started = 1; > return NULL; > } > > /* GDB will "next" over this call -- a new thread is spawned inside. */ > static void > spawn_thread_here (void) > { > pthread_t t; > pthread_create (&t, NULL, short_lived, NULL); > pthread_join (t, NULL); > } > > /* GDB will "next" over this call -- the short-lived background thread > is in the process of exiting while we step. */ > static void > exit_thread_here (void) > { > /* Just a visible marker so GDB can stop here. */ > volatile int x = 42; > (void)x; > } > > void > do_steps (void) > { > volatile int a = 1; > volatile int b = 2; > volatile int c = a + b; > volatile int d = c * 2; > volatile int e = d - a; > volatile int f = e + c; > volatile int g = f / 2; > volatile int h = g + 1; > volatile int i2 = h * h; > volatile int j = i2 - b; > (void)j; > } > > int > main (void) > { > pthread_t threads[NUM_THREADS]; > pthread_t bg; > int i; > > /* Start background spinning threads. */ > for (i = 0; i < NUM_THREADS; i++) > pthread_create (&threads[i], NULL, worker, NULL); > > /* Next over a call that spawns a thread */ > spawn_thread_here (); > > /* Next while a background thread is exiting > Launch a thread that exits quickly; "next" through exit_thread_here() > while that exit is in flight. */ > pthread_create (&bg, NULL, short_lived, NULL); > exit_thread_here (); > pthread_join (bg, NULL); > > do_steps (); > > keep_running = 0; > for (i = 0; i < NUM_THREADS; i++) > pthread_join (threads[i], NULL); > > return 0; > } I would expect the benchmark program to have a ton of threads, to show what a worst case scenario of get_signaled_thread looks like. This program appears to spawn 3 threads max, that means before the patch you'd get 3-4 getthrds calls, and after the patch you'd get 1. I suppose it would be more interesting to see what happens when you have e.g. 1000 threads, in which case the number of getthrds calls goes from 1000 to 16. Also, since there is an early return in get_signaled_thread, if you want to show the worst case, you'd need to set things up such that the signaled thread is in the last batch, ideally the last thread (assuming the order in which the kernel returns threads is predictable). > ============ > Benchmark GDB code: > > // cat ../bench_next.gdb > set pagination off > set confirm off > maintenance set per-command time on > > # Scenario 1: next over a call that spawns a thread > break spawn_thread_here > run > next > > # Scenario 2: next while a background thread is exiting > break exit_thread_here > continue > next > > break do_steps > continue > > next > next > next > next > next > next > next > next > next > next > > quit > > =============== > # cd /current_gdb && time /current_gdb/binutils-gdb/gdb/gdb -batch -x bench_next.gdb ./bench_next_bin 2>&1 | grep -E "^(real|user|sys)|volatile int > |pd_update total|sync_thread|pthdb_session" > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "pd_update total": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "pd_update total": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.146, user 0.081, sys 0.085, user+sys 0.166, 14.5 % CPU > Time for "pd_update total": wall 1.146, user 0.081, sys 0.085, user+sys 0.166, 14.5 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.025, user 0.092, sys 0.092, user+sys 0.184, 18.0 % CPU > Time for "pd_update total": wall 1.025, user 0.092, sys 0.092, user+sys 0.184, 18.0 % CPU > 25 volatile int a = 1; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.962, user 0.098, sys 0.095, user+sys 0.193, 20.1 % CPU > Time for "pd_update total": wall 0.962, user 0.098, sys 0.095, user+sys 0.193, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.965, user 0.098, sys 0.094, user+sys 0.192, 19.9 % CPU > Time for "pd_update total": wall 0.965, user 0.098, sys 0.094, user+sys 0.192, 19.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.954, user 0.098, sys 0.094, user+sys 0.192, 20.1 % CPU > Time for "pd_update total": wall 0.954, user 0.098, sys 0.094, user+sys 0.192, 20.1 % CPU > 26 volatile int b = 2; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.949, user 0.098, sys 0.094, user+sys 0.192, 20.2 % CPU > Time for "pd_update total": wall 0.949, user 0.098, sys 0.094, user+sys 0.192, 20.2 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.957, user 0.098, sys 0.094, user+sys 0.192, 20.1 % CPU > Time for "pd_update total": wall 0.957, user 0.098, sys 0.094, user+sys 0.192, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.033, user 0.101, sys 0.098, user+sys 0.199, 19.3 % CPU > Time for "pd_update total": wall 1.033, user 0.101, sys 0.098, user+sys 0.199, 19.3 % CPU > 27 volatile int c = a + b; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.031, user 0.101, sys 0.098, user+sys 0.199, 19.3 % CPU > Time for "pd_update total": wall 1.031, user 0.101, sys 0.098, user+sys 0.199, 19.3 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.028, user 0.100, sys 0.098, user+sys 0.198, 19.3 % CPU > Time for "pd_update total": wall 1.028, user 0.100, sys 0.098, user+sys 0.198, 19.3 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.996, user 0.100, sys 0.098, user+sys 0.198, 19.9 % CPU > Time for "pd_update total": wall 0.996, user 0.100, sys 0.098, user+sys 0.198, 19.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.000, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > Time for "pd_update total": wall 1.001, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.998, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > Time for "pd_update total": wall 0.998, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > 28 volatile int d = c * 2; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.999, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > Time for "pd_update total": wall 0.999, user 0.098, sys 0.098, user+sys 0.196, 19.6 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.001, user 0.099, sys 0.098, user+sys 0.197, 19.7 % CPU > Time for "pd_update total": wall 1.001, user 0.099, sys 0.098, user+sys 0.197, 19.7 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.969, user 0.100, sys 0.095, user+sys 0.195, 20.1 % CPU > Time for "pd_update total": wall 0.969, user 0.100, sys 0.095, user+sys 0.195, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.980, user 0.099, sys 0.096, user+sys 0.195, 19.9 % CPU > Time for "pd_update total": wall 0.980, user 0.099, sys 0.096, user+sys 0.195, 19.9 % CPU > 29 volatile int e = d - a; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.984, user 0.100, sys 0.096, user+sys 0.196, 19.9 % CPU > Time for "pd_update total": wall 0.984, user 0.100, sys 0.096, user+sys 0.196, 19.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.094, user 0.098, sys 0.094, user+sys 0.192, 17.6 % CPU > Time for "pd_update total": wall 1.094, user 0.099, sys 0.094, user+sys 0.193, 17.6 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.019, user 0.106, sys 0.097, user+sys 0.203, 19.9 % CPU > Time for "pd_update total": wall 1.019, user 0.106, sys 0.097, user+sys 0.203, 19.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.002, user 0.106, sys 0.096, user+sys 0.202, 20.2 % CPU > Time for "pd_update total": wall 1.002, user 0.106, sys 0.096, user+sys 0.202, 20.2 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.003, user 0.105, sys 0.096, user+sys 0.201, 20.0 % CPU > Time for "pd_update total": wall 1.003, user 0.105, sys 0.096, user+sys 0.201, 20.0 % CPU > 30 volatile int f = e + c; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.011, user 0.106, sys 0.097, user+sys 0.203, 20.1 % CPU > Time for "pd_update total": wall 1.011, user 0.106, sys 0.097, user+sys 0.203, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.010, user 0.107, sys 0.096, user+sys 0.203, 20.1 % CPU > Time for "pd_update total": wall 1.010, user 0.107, sys 0.096, user+sys 0.203, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.026, user 0.110, sys 0.096, user+sys 0.206, 20.1 % CPU > Time for "pd_update total": wall 1.026, user 0.110, sys 0.096, user+sys 0.206, 20.1 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.200, user 0.090, sys 0.085, user+sys 0.175, 14.6 % CPU > Time for "pd_update total": wall 1.201, user 0.090, sys 0.085, user+sys 0.175, 14.6 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.212, user 0.090, sys 0.091, user+sys 0.181, 14.9 % CPU > Time for "pd_update total": wall 1.212, user 0.090, sys 0.091, user+sys 0.181, 14.9 % CPU > 31 volatile int g = f / 2; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 0.993, user 0.103, sys 0.096, user+sys 0.199, 20.0 % CPU > Time for "pd_update total": wall 0.993, user 0.103, sys 0.096, user+sys 0.199, 20.0 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.258, user 0.079, sys 0.082, user+sys 0.161, 12.8 % CPU > Time for "pd_update total": wall 1.258, user 0.079, sys 0.082, user+sys 0.161, 12.8 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.255, user 0.080, sys 0.081, user+sys 0.161, 12.8 % CPU > Time for "pd_update total": wall 1.255, user 0.080, sys 0.081, user+sys 0.161, 12.8 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.259, user 0.080, sys 0.081, user+sys 0.161, 12.8 % CPU > Time for "pd_update total": wall 1.259, user 0.080, sys 0.081, user+sys 0.161, 12.8 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.264, user 0.080, sys 0.082, user+sys 0.162, 12.8 % CPU > Time for "pd_update total": wall 1.265, user 0.080, sys 0.082, user+sys 0.162, 12.8 % CPU > 32 volatile int h = g + 1; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.261, user 0.079, sys 0.083, user+sys 0.162, 12.8 % CPU > Time for "pd_update total": wall 1.261, user 0.079, sys 0.083, user+sys 0.162, 12.8 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.232, user 0.076, sys 0.081, user+sys 0.157, 12.7 % CPU > Time for "pd_update total": wall 1.232, user 0.076, sys 0.081, user+sys 0.157, 12.7 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.250, user 0.078, sys 0.083, user+sys 0.161, 12.9 % CPU > Time for "pd_update total": wall 1.250, user 0.078, sys 0.083, user+sys 0.161, 12.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.258, user 0.080, sys 0.084, user+sys 0.164, 13.0 % CPU > Time for "pd_update total": wall 1.258, user 0.080, sys 0.084, user+sys 0.164, 13.0 % CPU > 33 volatile int i2 = h * h; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.276, user 0.082, sys 0.082, user+sys 0.164, 12.9 % CPU > Time for "pd_update total": wall 1.276, user 0.082, sys 0.082, user+sys 0.164, 12.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.271, user 0.083, sys 0.081, user+sys 0.164, 12.9 % CPU > Time for "pd_update total": wall 1.271, user 0.083, sys 0.081, user+sys 0.164, 12.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.280, user 0.079, sys 0.086, user+sys 0.165, 12.9 % CPU > Time for "pd_update total": wall 1.280, user 0.079, sys 0.086, user+sys 0.165, 12.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.211, user 0.075, sys 0.081, user+sys 0.156, 12.9 % CPU > Time for "pd_update total": wall 1.211, user 0.075, sys 0.081, user+sys 0.156, 12.9 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.264, user 0.077, sys 0.086, user+sys 0.163, 12.9 % CPU > Time for "pd_update total": wall 1.264, user 0.077, sys 0.086, user+sys 0.163, 12.9 % CPU > 34 volatile int j = i2 - b; > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.240, user 0.078, sys 0.081, user+sys 0.159, 12.8 % CPU > Time for "pd_update total": wall 1.240, user 0.078, sys 0.081, user+sys 0.159, 12.8 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.256, user 0.078, sys 0.082, user+sys 0.160, 12.7 % CPU > Time for "pd_update total": wall 1.257, user 0.078, sys 0.082, user+sys 0.160, 12.7 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.267, user 0.078, sys 0.082, user+sys 0.160, 12.6 % CPU > Time for "pd_update total": wall 1.267, user 0.078, sys 0.082, user+sys 0.160, 12.6 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.254, user 0.079, sys 0.081, user+sys 0.160, 12.8 % CPU > Time for "pd_update total": wall 1.255, user 0.079, sys 0.081, user+sys 0.160, 12.7 % CPU > Time for "pthdb_session_update": wall 0.000, user 0.000, sys 0.000, user+sys 0.000, NaNQ % CPU > Time for "sync_threadlists": wall 1.257, user 0.078, sys 0.082, user+sys 0.160, 12.7 % CPU > Time for "pd_update total": wall 1.257, user 0.078, sys 0.082, user+sys 0.160, 12.7 % CPU I don't see any "Time for" line for get_signaled_thread, which is the function you are optimizing in this patch... am I missing something? Simon