public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Pavel Emelyanov <xemul-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
Cc: Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
	Linux FS Devel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	Andrew Morton
	<akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Andrew Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>,
	Michael Kerrisk
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Kirill Kolyshkin <kir-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>,
	Jason Baron <jbaron-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>,
	Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC 1/3] procfs: fdinfo -- Extend information about epoll target files
Date: Wed, 22 Feb 2017 11:35:34 +0300	[thread overview]
Message-ID: <20170222083534.GG22938@uranus> (raw)
In-Reply-To: <58AD4BE3.2080803-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>

On Wed, Feb 22, 2017 at 11:29:23AM +0300, Pavel Emelyanov wrote:
> On 02/22/2017 11:18 AM, Cyrill Gorcunov wrote:
> > On Wed, Feb 22, 2017 at 11:09:23AM +0300, Pavel Emelyanov wrote:
> >>>>
> >>>> Actually it shouldn't. If you extend the kcmp argument to accept the
> >>>> epollfd:epollslot pair, this would be effectively the same as if you
> >>>> had all your epoll-ed files injected into your fdtable with "strange"
> >>>> fd numbers. We already have two-level rbtree for this in criu, adding
> >>>> extended ("strange") fd to it should be OK.
> >>>
> >>> Nope. Pavel, I guess you forget how we handle file tree in criu currently.
> >>> We call for kcmp only if we have to -- when primary key for two entries
> >>> is the same.
> >>
> >> True, but the latter is an optimization to reduce the number of syscalls.
> > 
> > Exactly. While syscalls are quite effective, they are still not coming
> > for free, so I'm trying to reduce their number as much as possible.
> > 
> >> Look, in order to have a primary key you need to do some system call for the
> >> fd you check (read from proc or stat the descriptor). But for target files in
> >> e-polls you don't make this per-fd syscall to get primary key, just call the
> >> kcmp instead.
> > 
> > I have to parse fdinfo anyway, because I need to fetch queued events and mask.
> > So I'll _have_ to make this per-fd syscall for parsing. And this opens
> > a way to optimize overall picture -- we can immediately read primary
> > key and reduce kcmp calls.
> 
> You read fdinfo per-epoll, but kcmp-s we're talking here are about per-target-files.
> So having dev:ino pair would help to reduce the number of kcmps, but even w/o
> this extension we can work OK.

I didn't say we can't. But since we're reading fdinfo anyway it will help I don't
see a single reason why should not we take this opportunity to speedup.

> Besides, in most of the cases fd number you'd read from epoll's fdinfo will actually
> be present in task's fdtable, so you can call a single kcmp, make sure the file is
> correct and that's it. The need to actually _search_ for the runaway file with the
> set of kcmp will (should) be quite rare case.

Yes. But this rare cases are the reason why I started this series :( I would
love to not add new code at all but simply had to.

      parent reply	other threads:[~2017-02-22  8:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 16:59 [RFC 1/3] procfs: fdinfo -- Extend information about epoll target files Cyrill Gorcunov
     [not found] ` <20170221171254.954209904-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2017-02-21 18:41   ` Andy Lutomirski
2017-02-21 19:16     ` Cyrill Gorcunov
2017-02-22  7:44       ` Pavel Emelyanov
     [not found]         ` <58AD4147.20801-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-02-22  7:54           ` Cyrill Gorcunov
2017-02-22  8:09             ` Pavel Emelyanov
     [not found]               ` <58AD4733.5060304-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-02-22  8:18                 ` Cyrill Gorcunov
2017-02-22  8:29                   ` Pavel Emelyanov
     [not found]                     ` <58AD4BE3.2080803-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-02-22  8:35                       ` Cyrill Gorcunov [this message]

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=20170222083534.GG22938@uranus \
    --to=gorcunov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
    --cc=avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=jbaron-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org \
    --cc=kir-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=xemul-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
    /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