From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 4A4673857C44 for ; Fri, 21 May 2021 09:58:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4A4673857C44 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-HfcxR8X-NBywn3eSgZPsyw-1; Fri, 21 May 2021 05:58:46 -0400 X-MC-Unique: HfcxR8X-NBywn3eSgZPsyw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 508E7801B12; Fri, 21 May 2021 09:58:45 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-228.ams2.redhat.com [10.36.113.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 776C15D9DE; Fri, 21 May 2021 09:58:44 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 01/10] nptl: Perform signal initialization upon pthread_create References: <87bl95jiqs.fsf@oldenburg.str.redhat.com> <46b68c50-e1d9-1450-d3ea-a302b86e2949@linaro.org> <87wnrti31f.fsf@oldenburg.str.redhat.com> <91fc0623-3f90-e5e9-2149-454c781dfc33@linaro.org> Date: Fri, 21 May 2021 11:58:42 +0200 In-Reply-To: <91fc0623-3f90-e5e9-2149-454c781dfc33@linaro.org> (Adhemerval Zanella's message of "Thu, 20 May 2021 17:32:24 -0300") Message-ID: <87tumwcsrx.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:58:50 -0000 * Adhemerval Zanella: >>> Bu the main advantage is to move the cancellation code logically when >>> it is actually used, and it is small improvement on both static >>> linking (since the static code will be used solely is cancellation is >>> used) and on runtime (since sigaction will be set only if pthread_cancel >>> is called). >> >> Okay, I can prepare a version along these lines. But in general, I >> consider less data and fewer conditionals an improvement. > > Thanks. Unfortunately, it does not work with the present implementation. sysdeps/unix/sysv/linux/createthread.c contains this: /* The operation failed. We have to kill the thread. We let the normal cancellation mechanism do the work. */ pid_t pid = __getpid (); INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid, SIGCANCEL); This obviously needs a working SIGCANCEL handler, so pthread_create and pthread_cancel are not as separate as we thought. So I think we should go with my original version for the time being. We can switch to lazy initialization if we implement a different way for handling late thread creation failure. SIG_IGN handler disposition should not affect timer_create (which uses SIGCANCEL internally) because sigwaitinfo still wakes up on such signals. Thanks, Florian