Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1069905pxm; Wed, 23 Feb 2022 17:19:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhlh8VauHLp499xtDwNelm7WeHM5ZzOUKWn8lTFAASNgTvek+g1Z79RyIMlzW0rz6jgpsm X-Received: by 2002:a17:902:758c:b0:14f:c842:eaf6 with SMTP id j12-20020a170902758c00b0014fc842eaf6mr507332pll.152.1645665571607; Wed, 23 Feb 2022 17:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645665571; cv=none; d=google.com; s=arc-20160816; b=N+TwDnFgN53zZXZ5/By48kZGxvayvOpN1QO5DqKdsWx/2MXt8G+xhK7GIhGUJS0aGU YnDR/3P0n7O2/nr8BP5Dek478GPfOxmNVkfMVEDoyTEDET/y5h5bbWxKLtsdZ3x/xRvT 7bREwd9/3nhXiTchQkSwhj2e6K965F56ctCGo0Ruza58FeFM3bIsgh0I7mSCGqMmfxEk KwBPjDB0+6PHuYQnqImKBffRyUVWz7yGL+3UtgObppMD2KJABOtxzMT1N7oz644plis0 QVGlCEw6+AnxpGFnMUi5GJXUtKTWygGNqRbQxvtSN5EFhoHSNVi9HWCOl/vIPzo5iYJi RRaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=BNZ+isROfd+BGY/OEOE1KgVDDCf8NLPTyHvG3JJmVG8=; b=jY0wmGajqT2+MHVeL3s788eK76T+bXVfXbznVc7lPF+Dwb8NOPdJOt9ZPfOze85+N4 UwMZL2qktaV+OtpTs3KswA9UcD9YsnvAoL/qmCeaifaV0B56Y4caJN8qy1yEO1TswyQP Eg1esHh/adqliw1vBj+GblCV4nMSqsgJkd+9JUIyBJ2QlR5cRVmSvwDEGdWXhsts7a1e VakF+8E+AI6H+rer6zjVrLeZYH242nALRmm/c7hSPem6K2q150hw9S1xX36OTATs5rzh VCySAHHq6r5MucD0X6A2e2JnfjrJjZAioIUHuh6dLHkeNzYQefIWb4ivW/G1QPWheG6u qMrA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d15si1334610pfv.39.2022.02.23.17.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:19:31 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 49BC417CC7B; Wed, 23 Feb 2022 17:03:51 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234685AbiBWWlB convert rfc822-to-8bit (ORCPT + 99 others); Wed, 23 Feb 2022 17:41:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbiBWWlA (ORCPT ); Wed, 23 Feb 2022 17:41:00 -0500 Received: from mxchg04.rrz.uni-hamburg.de (mxchg04.rrz.uni-hamburg.de [134.100.38.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E8828D; Wed, 23 Feb 2022 14:40:30 -0800 (PST) X-Virus-Scanned: by University of Hamburg ( RRZ / mgw04.rrz.uni-hamburg.de ) Received: from exchange.uni-hamburg.de (UN-EX-MR08.uni-hamburg.de [134.100.84.75]) by mxchg04.rrz.uni-hamburg.de (Postfix) with ESMTPS; Wed, 23 Feb 2022 23:40:28 +0100 (CET) Received: from plasteblaster (89.244.207.27) by UN-EX-MR08.uni-hamburg.de (134.100.84.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.18; Wed, 23 Feb 2022 23:40:28 +0100 Date: Wed, 23 Feb 2022 23:40:27 +0100 From: "Dr. Thomas Orgis" To: "Eric W. Biederman" CC: Greg Kroah-Hartman , , , Balbir Singh , Sudip Mukherjee Subject: Re: [PATCH 5.4 32/80] taskstats: Cleanup the use of task->exit_code Message-ID: <20220223234027.30566235@plasteblaster> In-Reply-To: <87sfsa8nmf.fsf@email.froward.int.ebiederm.org> References: <20220221084915.554151737@linuxfoundation.org> <20220221084916.628257481@linuxfoundation.org> <20220221234610.0d23e2e0@plasteblaster> <87sfsa8nmf.fsf@email.froward.int.ebiederm.org> Organization: =?UTF-8?B?VW5pdmVyc2l0w6R0?= Hamburg X-Mailer: Claws Mail (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [89.244.207.27] X-ClientProxiedBy: UN-EX-MR02.uni-hamburg.de (134.100.84.69) To UN-EX-MR08.uni-hamburg.de (134.100.84.75) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Tue, 22 Feb 2022 17:53:12 -0600 schrieb "Eric W. Biederman" : > How do you figure? I admit that I am struggling with understanding where exit codes come from in the non-usual cases. During my taskstats tests, I played with writing a multithreaded application that does call pthread_exit() in the main thread (pid==tgid), for example. I slowly had to learn just how messy this can be … Is it clearly defined what the exitcode of a task as part of a process is/should/can mean, as opposed to the process as a whole? > For single-threaded processes ac_exitcode would always be reasonable, > and be what userspace passed to exit(3). Yes. That is the one case where we all know what we are dealing with;-) > For multi-threaded processes ac_exitcode before my change was set to > some completely arbitrary value for the thread whose tgid == tid. Isn't the only place where it really makes sense to set the exitcode when the last task of the process exits? I guess that was the intention of the earlier code — with the same wrong assumption that I fell victim to for quite some time: That the group leader (first task, tgid == pid) always exits last. I do not know in which cases group member threads have meaningful exit codes different from the last one (which is the one returned for the process in whole … ?). I'd love to see the exact reasoning on how multithreading got mapped into kernel tasks which used to track only single-threaded processes before. > With my change the value returned > is at least well defined. But defined to what? > Now maybe it would have been better to flag the bug fix with a version > number. Unfortunately I did not even realize taskstats had a version > number. I just know the code made no sense. Well, fixing a bug that has been there from the beginning (of adding multithreading, at least) is a significant change that one might want to know about. And I do think that it fits to thouroughly fix these issues that relate to identifying threads and processes (the shameless plug of my taskstats patch that I'm working on since 2018, and only got right in 2022, finally — I hope), while at that. Alrighty then, Thomas -- Dr. Thomas Orgis HPC @ Universität Hamburg