From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C8F3A04AB; Wed, 6 Nov 2019 15:36:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 899EC1BF96; Wed, 6 Nov 2019 15:36:38 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 1B3FBCF3 for ; Wed, 6 Nov 2019 15:36:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573050996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y559VfMyAZz9Wwq358njm6cmYb6LH6C5LNbaQZ24x5I=; b=eS12OhGGzgdow8l1nT2Xsnio8h6/v3GjB9jy5OAObL39yMnxVSqF1/7v31scF1P2BYWzah trT4wwRNaysIwPj7uAdZYhDCaczWrBEGUt0jqPNuEMpFnLa5l3+jL1D5VzNa9hTHSEYiR/ MYylorVGrFzjWdk7smeQi6Y4SmOtwu0= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-jJ3Vi1ZrN1CscwG2bQSNcw-1; Wed, 06 Nov 2019 09:36:34 -0500 Received: by mail-vs1-f70.google.com with SMTP id e127so1971349vsc.16 for ; Wed, 06 Nov 2019 06:36:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BBFnwRXvW8KALxz1xLN0SRWN2BGB+p69DcFUvDovNeQ=; b=XkdQiGHBDrZ3nu7EDZeqqjceHUel5lcKIpW36/SogYFjdRldBPTZw8SqluHP8TeX6t RuSKPpyGRZH4MYFvAEcBjStC0BdMupRH8UjuL+JVDUVh6zDS2Af5tqc1lDjfRO6L9dtK 1gROl7EgSTyPYSeBL8igTvViddlohSIo4P4yM+5fJomt68hJWGiNG5wams/6ua0Hco3m Fale0JljR6AiS7t448R4Q8vtA/okVBxGRHgdfNQdEOOtXwA5kFnyGVOMExjkWwiNtqgn cPjoBoex9+eIgxw40HuMHHsAbwvV3h2HR1mIzupkGtko79EkmsdZWYXttwXUutJyJHf+ DunA== X-Gm-Message-State: APjAAAVMPW2rH63ZsP47ov3oKh9K4wZIXtGMHJ47bNY4ctdJzKZoZRVN bp0t1zrTxbcs2HZGEg3NzbFjCx9vWo8dxEG/oP9vg7ZAkOnyP+ewuZyJZ/QhbPzVdF9hDH9KXKZ nERAUobm37A8ycrt/I9g= X-Received: by 2002:ab0:628f:: with SMTP id z15mr1344557uao.126.1573050994049; Wed, 06 Nov 2019 06:36:34 -0800 (PST) X-Google-Smtp-Source: APXvYqydvLM5hfduVQ527SU/6qmGkqBaA5zCknqva1QByqLCq6xdSOFX3+l8C7J1uBU4FBlBtbHX+JBxuwd+tUswnDo= X-Received: by 2002:ab0:628f:: with SMTP id z15mr1344530uao.126.1573050993543; Wed, 06 Nov 2019 06:36:33 -0800 (PST) MIME-Version: 1.0 References: <20190902075251.2917-1-kkanas@marvell.com> <20190902094939.20482-1-kkanas@marvell.com> <20191104075219.GA8346@kk-box-0> In-Reply-To: <20191104075219.GA8346@kk-box-0> From: David Marchand Date: Wed, 6 Nov 2019 15:36:22 +0100 Message-ID: To: Krzysztof Kanas Cc: dev X-MC-Unique: jJ3Vi1ZrN1CscwG2bQSNcw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2] test: fix process dup fd close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Nov 4, 2019 at 8:52 AM Krzysztof Kanas wrote: > > On 19-10-30 10:06, David Marchand wrote: > > External Email > > > > ---------------------------------------------------------------------- > > On Mon, Sep 2, 2019 at 11:50 AM wrote: > > > > > > From: Krzysztof Kanas > > > > > > process_dup was intending to close it's own fd's but failed to do so > > > > A bit hard to digest, what is the problem that you want to fix? > > > > Thanks. > > I don't recall the exact test name but I think it was test_eal_flags > that is included in the meson test suite for fast tests. > This test was timing out on ARM64. > > Using strace (-f -c IIRC) showed that the process is spending most of > the time in access syscall trying to close not existing fd's. > > - for (fd =3D getdtablesize(); fd > 2; fd-- ) { > - snprintf(path, sizeof(path), "/proc/" exe "/fd/%d= ", fd); > - if (access(path, F_OK) =3D=3D 0) > - close(fd); > > So the simplest way to do so is to close only the opened fd's not > blindly try every possible one. > > Also I think the code was wrong in another way as it tried to iterate > over /proc/ *exe* /fd/%d/ when it should iterate over /proc/ *self* > /fd/, so either the comment bove the for loop was wrong or the code was > incorrect. Thanks. I agree that this loop is terrible. I have some comments on the patch. --=20 David Marchand