Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp419838pxb; Wed, 6 Oct 2021 07:46:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKv7TDEbldNupmEISRipmVDBgVbXzivlZzmAGW0EqJo1r5lf7L6ksAMNtJ1lX4JomG5rak X-Received: by 2002:a17:903:248f:b029:128:d5ea:18a7 with SMTP id p15-20020a170903248fb0290128d5ea18a7mr11467775plw.83.1633531575971; Wed, 06 Oct 2021 07:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633531575; cv=none; d=google.com; s=arc-20160816; b=C7W/NE4WynPHFXaveLa0pGOXJKUOb8VbTRWlbayPNv0ZBfqc5UjgbpV+weg8iErCeC 6qMavKnYqHeBxCFB4iYkfFIYIQ15x1lXeWyTxpxJb6Cq3V8oT1Z2o22LyVuIx/lV0o1k JyodH6WcSUN5qEDithv30bPr+pn/lhLS9ZuQk8SQOQLLoSZUo897f2oA/rSSDfzO9PxI yTbknw1WeJ5LE4Obmvcgs2aHtvkS25wSZwEPkevynGNOI0SOBqSnUQEthuaOJzE1+E3p IAnrZVmRl6zePyLLaIXLHC0lFm/lIasgAXg2l71PCLeoYRFt1kTbTB1Jzb+WpvcKa9JG xd5A== 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:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=JBtRY365OM1Ze3t730v+NQ8ra3UU6eUF9sKHTNUsFWA=; b=0Hi/VAdLWGR7mSinbsrPV1PAwR+av+/ucGJSxuqg1IqbBMzWrkWjnHgIH6u/ZVD5az b4H/i9Kcnt3vhiv3WIDcvgT33xrLiR34MBfWfgRIy0hl7x7J9NocToIWGPA1nRtB0QF4 ZfjBlcxauQ6gZncDioKVmUq0/PAW6rO6Xt6TQzjEmFWPq+KAxk2p7JuPDvQuDu00DaVl Ie3mMAOkxHUKjNLSqjKidsUdMw2Xri8CpP62DNFHC9rD9Sw3vzudyoJDHrciWCjlCwVc 2YNRYgnIvsrEeeXQ7k5O/Ml69fpCRLNTXEoNwYyLQdeVl94mqgxHiRvILfMQZcvu/6lj Vo5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=divqiK2P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ij23si16799184plb.7.2021.10.06.07.46.01; Wed, 06 Oct 2021 07:46:15 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=divqiK2P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238996AbhJFOq5 (ORCPT + 99 others); Wed, 6 Oct 2021 10:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbhJFOq4 (ORCPT ); Wed, 6 Oct 2021 10:46:56 -0400 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A59CC061749; Wed, 6 Oct 2021 07:45:04 -0700 (PDT) Received: by mail-oo1-xc31.google.com with SMTP id e16-20020a4ad250000000b002b5e1f1bc78so897386oos.11; Wed, 06 Oct 2021 07:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JBtRY365OM1Ze3t730v+NQ8ra3UU6eUF9sKHTNUsFWA=; b=divqiK2PDpi+uR9iGKV787gf0Ytr1H4MZVihs16FhO1uTZig6SXCuE3YF0GKAp9xUH 74o9AI04hjXjyyAY7wFpqHY69bkARFQ2Izp4VhzlS2ttUDbFkuAuRtaQPa6avGEzKulj V6kK4+s02wEeYAJpbZwpR1xp2zZNUtYG8qQTa9Xn/yfgobMSSWnPpS5DNiqdFIpEC6GF 5D7Y3WA5O+xthteDMs7pGVEkOo4XSriY4pjQ1ciwTjX/paRNNJZnyqYLBmO5SpYKgwKP 1nLFjFm36fI48Vdkw0ACZI8plSwnJyabbHT8TkvzMMqF/KuK2TZYBaXWDvXYJsJkhX1L jD5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JBtRY365OM1Ze3t730v+NQ8ra3UU6eUF9sKHTNUsFWA=; b=MjgfH0OFY0rtZ1uLuCjjOJhvhljdaiW49pTjXYiic/tobLeCLTuw3W549//PO9o0lG i3sql5WCgh66AJgP51nM2aHr74UmWiY1BZK5gAZ7ic8FKYIPXlfKsYQbFHTXMFTh2ByI sSpqJA4qgoJu176qccUl0TbfoSHxB/C/eli1ATo7vJ7sySy/P5umkmpQtU1F2jpMx2IS NIzhjrqLj2gSTfox6BIRXcNFJ6W7Fpq8gpox2qe6etBU+lPBY1x/EoBbBT8OonZsjdDg 6idTcw7R8Gx+oI5POVUZ3EB15zihe/g/dlU5uVCAHQ4eUqBY5wPzG3SKLLE6l1ClKiv5 O57w== X-Gm-Message-State: AOAM530K9F+vaU21lF6uAQI+VZixaj9ciozWVAxMsCpVHwUC77qX1HV8 9qCL5RUqzFipKzP6/jy+AJkNV5VnAavLog== X-Received: by 2002:a4a:bd8a:: with SMTP id k10mr18075050oop.41.1633531502868; Wed, 06 Oct 2021 07:45:02 -0700 (PDT) Received: from Davids-MacBook-Pro.local ([8.48.134.30]) by smtp.googlemail.com with ESMTPSA id e2sm4010099ooh.40.2021.10.06.07.45.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Oct 2021 07:45:02 -0700 (PDT) Subject: Re: [PATCH 05/11] selftests: net/fcnal: kill_procs via spin instead of sleep To: Leonard Crestez , Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: From: David Ahern Message-ID: Date: Wed, 6 Oct 2021 08:45:01 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: 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 10/6/21 5:47 AM, Leonard Crestez wrote: > Sleeping for one second after a kill is not necessary and adds up quite > quickly. Replace with a fast loop spinning until pidof returns nothing. > > Signed-off-by: Leonard Crestez > --- > tools/testing/selftests/net/fcnal-test.sh | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh > index 0bd60cd3bc06..b7fda51deb3f 100755 > --- a/tools/testing/selftests/net/fcnal-test.sh > +++ b/tools/testing/selftests/net/fcnal-test.sh > @@ -176,12 +176,19 @@ show_hint() > fi > } > > kill_procs() > { > - killall nettest ping ping6 >/dev/null 2>&1 > - sleep 1 > + local pids > + while true; do > + pids=$(pidof nettest ping ping6) > + if [[ -z $pids ]]; then > + break > + fi > + kill $pids > + sleep 0.01 > + done > } > > do_run_cmd() > { > local cmd="$*" > ideally the script keeps track of processes it launches and only kills those. The original killall was just a stop gap until the process tracking was added.