From: Alexander Shishkin <alexander.shishckin@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Shishkin <alexander.shishckin@gmail.com>,
akpm@linux-foundation.org, viro@zeniv.linux.org.uk,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [RFC] List per-process file descriptor consumption when hitting file-max
Date: Wed, 29 Jul 2009 19:17:00 +0300 [thread overview]
Message-ID: <71a0d6ff0907290917u1f0c0e68p8036d53c69320392@mail.gmail.com> (raw)
In-Reply-To: <1244461122-3303-1-git-send-email-alexander.shishckin@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 2423 bytes --]
2009/6/8 <alexander.shishckin@gmail.com>:> From: Alexander Shishkin <alexander.shishckin@gmail.com>>> When a file descriptor limit is hit, it might be useful to see all the> users to be able to identify those that leak descriptors.Is there anything dramatically wrong with this one, or could someoneplease review this?
> Signed-off-by: Alexander Shishkin <alexander.shishckin@gmail.com>> ---> Â fs/file_table.c | Â 27 +++++++++++++++++++++++++++> Â 1 files changed, 27 insertions(+), 0 deletions(-)>> diff --git a/fs/file_table.c b/fs/file_table.c> index 54018fe..9e53167 100644> --- a/fs/file_table.c> +++ b/fs/file_table.c> @@ -136,8 +136,35 @@ struct file *get_empty_filp(void)> Â over:> Â Â Â Â /* Ran out of filps - report that */> Â Â Â Â if (get_nr_files() > old_max) {> + Â Â Â Â Â Â Â struct task_struct *p;> + Â Â Â Â Â Â Â struct files_struct *files;> + Â Â Â Â Â Â Â struct fdtable *fdt;> + Â Â Â Â Â Â Â int i, count = 0;> +> Â Â Â Â Â Â Â Â printk(KERN_INFO "VFS: file-max limit %d reached\n",> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â get_max_files());> +> + Â Â Â Â Â Â Â read_lock(&tasklist_lock);> + Â Â Â Â Â Â Â for_each_process(p) {> + Â Â Â Â Â Â Â Â Â Â Â files = get_files_struct(p);> + Â Â Â Â Â Â Â Â Â Â Â if (!files)> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue;> +> + Â Â Â Â Â Â Â Â Â Â Â spin_lock(&files->file_lock);> + Â Â Â Â Â Â Â Â Â Â Â fdt = files_fdtable(files);> +> + Â Â Â Â Â Â Â Â Â Â Â /* we have to actually *count* the fds */> + Â Â Â Â Â Â Â Â Â Â Â for (count = i = 0; i < fdt->max_fds; i++)> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â count += !!fcheck_files(files, i);> +> + Â Â Â Â Â Â Â Â Â Â Â printk(KERN_INFO "=> %s [%d]: %d\n", p->comm,> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â p->pid, count);> +> + Â Â Â Â Â Â Â Â Â Â Â spin_unlock(&files->file_lock);> + Â Â Â Â Â Â Â Â Â Â Â put_files_struct(files);> + Â Â Â Â Â Â Â }> + Â Â Â Â Â Â Â read_unlock(&tasklist_lock);> +> Â Â Â Â Â Â Â Â old_max = get_nr_files();> Â Â Â Â }> Â Â Â Â goto fail;> --> 1.6.1.3>>
TIA,--Alexÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next parent reply other threads:[~2009-07-29 16:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1244461122-3303-1-git-send-email-alexander.shishckin@gmail.com>
2009-07-29 16:17 ` Alexander Shishkin [this message]
2009-07-30 12:40 ` Valdis.Kletnieks
2009-10-11 12:17 ` Alexander Shishkin
2010-01-11 9:38 ` [RFC][PATCHv3] " Alexander Shishkin
2010-01-11 12:40 ` Andreas Dilger
2010-01-13 22:06 ` Andi Kleen
2010-01-13 22:44 ` Al Viro
2010-01-13 22:57 ` Al Viro
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=71a0d6ff0907290917u1f0c0e68p8036d53c69320392@mail.gmail.com \
--to=alexander.shishckin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®