From patchwork Thu May 6 18:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43279 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B95763AAB4A0; Thu, 6 May 2021 18:11:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B95763AAB4A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620324662; bh=wKj80u1PHAHx/dHlGaQ/X3KGlKHc+Ms8OzV4w3ThbGY=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Lrb+dZ7LrVsiNrbz8g79fCdw9OS3fQ9ZEs1jKT0JJcfU42yEnZFAEu6CA344XQRD9 ASDvtj9fdY7+btaksEjhIL7z4S1O4CthdL4CT1oXupadMQhhbZuxvlrfhg/ctmh5ln RD06IHaKuzPItekfRD9/uOH9HesCkfEUMPoxu1zU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 8F5183AAB4A5 for ; Thu, 6 May 2021 18:10:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F5183AAB4A5 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-591-JFUxZk-qOQCT0lBd8HFJJQ-1; Thu, 06 May 2021 14:10:55 -0400 X-MC-Unique: JFUxZk-qOQCT0lBd8HFJJQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9125BC73BC for ; Thu, 6 May 2021 18:10:54 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-137.ams2.redhat.com [10.36.112.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5EEF60871 for ; Thu, 6 May 2021 18:10:53 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 11/13] nptl: Simplify resetting the in-flight stack in __reclaim_stacks In-Reply-To: References: Message-Id: Date: Thu, 06 May 2021 20:11:12 +0200 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" stack_list_del overwrites the in-flight stack variable. Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- nptl/allocatestack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 12cd1058d4..076cffd35b 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -799,6 +799,8 @@ __reclaim_stacks (void) elem->next->prev = elem->prev; elem->prev->next = elem->next; } + + GL (dl_in_flight_stack) = 0; } /* Mark all stacks except the still running one as free. */ @@ -842,7 +844,7 @@ __reclaim_stacks (void) /* Remove the entry for the current thread to from the cache list and add it to the list of running threads. Which of the two lists is decided by the user_stack flag. */ - stack_list_del (&self->list); + list_del (&self->list); /* Re-initialize the lists for all the threads. */ INIT_LIST_HEAD (&GL (dl_stack_used)); @@ -856,8 +858,6 @@ __reclaim_stacks (void) /* There is one thread running. */ __nptl_nthreads = 1; - GL (dl_in_flight_stack) = 0; - /* Initialize locks. */ GL (dl_stack_cache_lock) = LLL_LOCK_INITIALIZER; __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;