From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aB/AHEiGTGif7gwAWB0awg (envelope-from ) for ; Fri, 13 Jun 2025 16:12:56 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=default header.b=dzGi7wjS; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6D6511E102; Fri, 13 Jun 2025 16:12:56 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 D03031E0C2 for ; Fri, 13 Jun 2025 16:12:55 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 756A438101A9 for ; Fri, 13 Jun 2025 20:12:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 756A438101A9 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=default header.b=dzGi7wjS Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 15FB038940FD for ; Fri, 13 Jun 2025 20:12:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15FB038940FD 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 15FB038940FD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749845543; cv=none; b=vpu+6Q7bCwJaaAb/g1sr5hbgVuog93GwPNr96xDsDGZTW+I1shuY8Kyo5XVQT1CLzg09A1W777kNLj9XPEJ3r8OP3fxioEZR44fmNarkam6L+U0ADvL+/1jIrJD0SnFhlyKWtFmuVOpwRBDh6qnyQ8m7UK9IlXFxz6Bk6/FG9ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749845543; c=relaxed/simple; bh=70uiCIhNd3lt+LYHi9HUT1duoqHWVqxdeCqhYKKDVcI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=mo5xvTephuR04uWp6BVORsYKg2Vz568sSbX5uRLBD2ZTYbhGSJiV4jXUeNEXkZf3jn1Yh1G4yTsVMSuONjq+NO6S7zLWgfzT3OBom06joH4HjPk3hstHs4IClXUAjMbUAVndUWoA9TbesciewoTJOoVb7HR2vKBsB06idA40hd4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15FB038940FD 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 55DKCHFs062476 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 Jun 2025 16:12:22 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 55DKCHFs062476 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1749845542; bh=3Bp9c5AnLYtydvIHCjIA3j1zKuIlMjxvjwMX/F9OhCE=; h=Date:Subject:To:Cc:From:In-Reply-To:From; b=dzGi7wjSvx+gbn4LDTRZ8KWU921txAt+P6gzI+AOul0FggQo8dbvDoP5CwaEBeoXv ca7gpajTJ4FshI0QGIl5tzQXneN4IJAbHO7Xm1Z4zWcz/kPW16XpPnkGjJI83Qe4Zn Fz1OzWAL4/FE0v6agoDC3vFy6FMTFLIFUc9YxIWE= Received: by simark.ca (Postfix, from userid 112) id BC24A1E126; Fri, 13 Jun 2025 16:12:17 -0400 (EDT) Received: from [172.16.0.192] (192-222-132-26.qc.cable.ebox.net [192.222.132.26]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0663D1E0C2; Fri, 13 Jun 2025 16:12:15 -0400 (EDT) Message-ID: <2047e4f3-49d3-4dde-991a-8e22bd80c6ef@polymtl.ca> Date: Fri, 13 Jun 2025 16:12:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/6] gdbsupport: use dynamic partitioning in gdb::parallel_for_each To: Simon Marchi , Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20250505201548.184917-1-simon.marchi@efficios.com> <20250505201548.184917-3-simon.marchi@efficios.com> <87tt4jjy13.fsf@tromey.com> <46f028fd-14f8-49a5-afc1-d6661d6f84ac@polymtl.ca> Content-Language: fr From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 13 Jun 2025 20:12:17 +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 6/13/25 3:56 PM, Simon Marchi wrote: > On 6/13/25 3:22 PM, Simon Marchi wrote: >> Another idea I had (but didn't try) was to make lambdas receive a >> "magic" range object, like athis: >> >> [&] (gdb::dynamic_range range) >> { >> for (dwarf2_per_cu *cu : range) >> process_unit (cu); >> } >> >> "range" would get work items from the work queue in batches, but yield >> one at a time. It would reach its end when the work queue is empty. >> It will be a bit of work to implement, but it would have the advantage >> that any per-worker state could be right there in the lambda, like we >> have today. > > Ah, I remembered why I didn't do this. It wouldn't play well with how > minimal_symbol_reader::install() currently uses gdb::parallel_for_each. > Currently, it receives one contiguous range [start,end). After having > computed the demangled names and hashes for the whole range, each worker > locks a mutex and installs the names in a shared hash table. > > In my patch, it's similar, but each worker installs the names in the > share hash table at the end of each small range it receives. > > With my "magic" iterator idea, it wouldn't be clear when and how to > install the names in the shared hash table. One way to make this work would be to make the iterator yield batches, so you would have two levels of iteration: [&] (gdb::dynamic_range range) { for (gdb::batch batch : range) { for (minimal_symbol *msym : batch) { // compute demangled name and hash } // lock mutex for (minimal_symbol *msym : batch) { // install msym in the shared hash table } } } Let me know if you see an easier solution to this. Simon