All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: linux-kernel@vger.kernel.org
Subject: [patch 0/7] Rework file::show_fdinfo method to use seq-files engine, v2
Date: Wed, 06 Nov 2013 15:47:42 +0400	[thread overview]
Message-ID: <20131106114742.988532945@openvz.org> (raw)

Hi, in criu we intensively use additional information provided by
/proc/<pid>/fdinfo/<fd> particular to the object opened file
represents. The output is printed out by calling the
file_operations::show_fdinfo method.

The implementation implies that data is getting printed in one
pass and returns error in case if seq buffer is overflowed, which
works fine while data fit one memory page. For epoll it's about
73 epoll targets can be printed, for notify system -- significantly
less depending on notify type and file handler. This limitation
didn't cause any problems in applications we're checkpointing
and restoring at moment, but might become a problem in future.

So to resolve the problem I considered two ways

1) Don't return error if seq-buffer overflowed thus, one
   show() method is called the kernel will notice that buffer is
   overflowed and double its size returning -EAGAIN. But I fear such
   interface might be misused (say process creates epoll with a number
   of target descriptors, then application opens a big number of fdinfo
   reader causing kernel to allocate big seq-buffer for each reader).

2) Instead of printing fdinfo in one pass rather provide seq-operations
   pointer in file_operations, and subsystems which need it simply hook
   own seq-operations here. The main code in fs/proc/fd.c will call for
   underlied seq-operation methods.

The second way looks more preferrable from my POV, here is the series.
Please take a look, thanks. Any comments are highly appreciated!

             reply	other threads:[~2013-11-06 11:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 11:47 Cyrill Gorcunov [this message]
2013-11-06 11:47 ` [patch 1/7] seq-file: Export single_ helpers Cyrill Gorcunov
2013-11-06 11:50   ` Christoph Hellwig
2013-11-06 11:58     ` Cyrill Gorcunov
2013-11-06 11:47 ` [patch 2/7] procfs: Introduce sequential fdinfo engine Cyrill Gorcunov
2013-11-06 11:47 ` [patch 3/7] epoll: Use " Cyrill Gorcunov
2013-11-06 11:47 ` [patch 4/7] eventfd: " Cyrill Gorcunov
2013-11-06 11:47 ` [patch 5/7] signalfd: " Cyrill Gorcunov
2013-11-06 11:47 ` [patch 6/7] fsnotify: " Cyrill Gorcunov
2013-11-06 11:47 ` [patch 7/7] procfs: Drop legacy show_fdinfo file operation Cyrill Gorcunov

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=20131106114742.988532945@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.