From: David Marchand <david.marchand@redhat.com>
To: Krzysztof Kanas <kkanas@marvell.com>
Cc: dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2] test: fix process dup fd close
Date: Wed, 6 Nov 2019 15:36:22 +0100 [thread overview]
Message-ID: <CAJFAV8w+ymjkpRwhWB2UaXwH01O5kieMExynDxRTx8ZTEZ0K3A@mail.gmail.com> (raw)
In-Reply-To: <20191104075219.GA8346@kk-box-0>
On Mon, Nov 4, 2019 at 8:52 AM Krzysztof Kanas <kkanas@marvell.com> wrote:
>
> On 19-10-30 10:06, David Marchand wrote:
> > External Email
> >
> > ----------------------------------------------------------------------
> > On Mon, Sep 2, 2019 at 11:50 AM <kkanas@marvell.com> wrote:
> > >
> > > From: Krzysztof Kanas <kkanas@marvell.com>
> > >
> > > 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 = getdtablesize(); fd > 2; fd-- ) {
> - snprintf(path, sizeof(path), "/proc/" exe "/fd/%d", fd);
> - if (access(path, F_OK) == 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.
--
David Marchand
next prev parent reply other threads:[~2019-11-06 14:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-02 7:52 [dpdk-dev] [PATCH] " kkanas
2019-09-02 9:49 ` [dpdk-dev] [PATCH v2] " kkanas
2019-09-23 11:32 ` Krzysztof Kanas
2019-10-30 9:06 ` David Marchand
2019-11-04 7:52 ` [dpdk-dev] [EXT] " Krzysztof Kanas
2019-11-06 14:36 ` David Marchand [this message]
2019-11-06 14:58 ` [dpdk-dev] " David Marchand
2019-11-08 10:21 ` [dpdk-dev] [PATCH v3 0/3] test: fix timeout in flags autotest kkanas
2019-11-08 10:21 ` [dpdk-dev] [PATCH v3 1/3] " kkanas
2019-11-08 10:21 ` [dpdk-dev] [PATCH v3 2/3] test: move close files to separate function kkanas
2019-11-08 10:21 ` [dpdk-dev] [PATCH v3 3/3] test: fix FreeBSD file closing function kkanas
2019-11-08 11:05 ` [dpdk-dev] [PATCH v3 0/3] test: fix timeout in flags autotest David Marchand
2019-11-08 11:11 ` David Marchand
2019-11-08 13:45 ` David Marchand
2019-11-12 8:26 ` [dpdk-dev] [EXT] " Krzysztof Kanas
2019-11-12 20:34 ` David Marchand
2019-11-13 13:35 ` Krzysztof Kanas
2019-11-12 20:31 ` [dpdk-dev] [PATCH v4] test: optimise fd closing in forked test process David Marchand
2019-11-14 19:31 ` Kevin Traynor
2019-11-15 8:11 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8w+ymjkpRwhWB2UaXwH01O5kieMExynDxRTx8ZTEZ0K3A@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=kkanas@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).