Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1491652pxf; Fri, 12 Mar 2021 10:43:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAbSQnmCriK/FhSYWa8qVMotd9SqYVV//Aoo8IL8tEPsRD0SNvp+rjR5loylemcjIII3NW X-Received: by 2002:a17:906:2710:: with SMTP id z16mr10207169ejc.176.1615574599434; Fri, 12 Mar 2021 10:43:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615574599; cv=none; d=google.com; s=arc-20160816; b=vy7DgKANe2Dxy5aYabsNizu64OSjmQvcrfmxXBXDKknZOGGTVf0LPJUhKV1oKvlJ44 8GIAdRxcqdOIXBuAQMxgKEQAR6UyVwnCrTVBY7nS3T2zJvP2rwI1X+M0ASN+2CAzaNBH tEyruT8qgEoUzqSTRr/cwtESQieNf8dDXD6kmrnBFscro/bGauEpIzYTHuq1xoCHZjjV wFpro+dAWiJSZz7n+d8gBvlI+8v9e2g4Di+DUI8OyL7xEPpQWc4VH5eUAcB7hr20nrmw phHYoiuWMJQUdMj+UtQwylO1+9ScKMWcH75rtwXqa37DAxK4sfYW/li4tx8pIwoD2f4i fZmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:date:message-id:organization:from :references:cc:to:subject; bh=32V8fMkPoSGLXg2cFdmp95GuPb5l/4DAa8+uClDMd8M=; b=VkaiWTSxEiuRig5f+9ZYTTXu7wXTnCu/MLDI2PkdnXhL9xLK4j9BkXItrFPsZ95u6Q ksg2mvMRLJn2M0Y8T2qSS/Iavg9zqVd5vy2FdIUvf+6MR9E73aZDw3UhOFDcxQqZyNR4 +CSEfecEXwMUrEAYxIEnR2Hc3E8ZYDxW/FgDuA9y13OT0X2ltCP6T55FWQ0U/xLaekFS 35J5VBL53/G8gRCeyLOHFZIU8NCimHvdt+gDCCN5kD8SVjYyvwiRxuEINCF0su0pxoh0 eLCcAiHo9F+1DVDDyIpGdfgcqJME3I2CLIpPqrOmOwI3WZ0wVSvZNG/5RzxqTJdSHmJB FCIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb25si5023605ejc.472.2021.03.12.10.42.56; Fri, 12 Mar 2021 10:43:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbhCLSjT (ORCPT + 99 others); Fri, 12 Mar 2021 13:39:19 -0500 Received: from mx1.riseup.net ([198.252.153.129]:60448 "EHLO mx1.riseup.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233517AbhCLSjO (ORCPT ); Fri, 12 Mar 2021 13:39:14 -0500 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4DxvjY6hMPzDv4G; Fri, 12 Mar 2021 10:39:13 -0800 (PST) X-Riseup-User-ID: 9761080F93156BC9C7A6806C2C7650E20C7CBBA6EC4AF15504943B3896730E07 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4DxvjY1LbKz1y6h; Fri, 12 Mar 2021 10:39:13 -0800 (PST) Subject: Re: [PATCH v5] do_wait: make PIDTYPE_PID case O(1) instead of O(n) To: Andrew Morton Cc: Oleg Nesterov , "Eric W . Biederman" , Christian Brauner , linux-kernel@vger.kernel.org References: <20210312173855.24843-1-jnewsome@torproject.org> <20210312102207.a347e38db375226a78cc37bf@linux-foundation.org> From: Jim Newsome Organization: The Tor Project Message-ID: Date: Fri, 12 Mar 2021 12:39:12 -0600 MIME-Version: 1.0 In-Reply-To: <20210312102207.a347e38db375226a78cc37bf@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/12/21 12:22, Andrew Morton wrote: > > Could we please see some performance testing results to permit us to > evaluate the value of this change? Sure. I've been doing some ad-hoc measurements with the code below. It forks 8k children and then waits for them in reverse order (forcing a full list traversal each time). I'll need to reboot a couple times to get apples-to-apples measurements on bare metal, though. I'll plan to run with NUMCHILDREN = 0 -> 8000, by 100. Does this look like it'd be sufficient, or is there more you'd like to see? The current form doesn't use ptrace, but I expect the results to be similar; (maybe more pronounced when tracing threaded children, since every thread is in the tracee list instead of just the group leaders). #define NUMCHILDREN 8000 void fork_and_wait() { pid_t children[NUMCHILDREN]; for (int i = 0; i < NUMCHILDREN; ++i) { pid_t forkrv = fork(); if (forkrv < 0) { perror("fork"); exit(1); } if (forkrv == 0) { // child exit(0); } // parent children[i] = forkrv; } for (int i = 0; i < NUMCHILDREN; ++i) { int wstatus; if (waitpid(children[NUMCHILDREN - i - 1], &wstatus, 0) < 0) { perror("waitpid"); exit(1); } } }