From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: "Américo Wang" <xiyou.wangcong@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 3/3][mmotm] updateing size of kcore
Date: Thu, 17 Sep 2009 16:14:32 +0900 [thread overview]
Message-ID: <20090917161432.97e06050.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <2375c9f90909162359m14ec7640m88ddd7ba54d6e793@mail.gmail.com>
On Thu, 17 Sep 2009 14:59:35 +0800
AmA(C)rico Wang <xiyou.wangcong@gmail.com> wrote:
> On Thu, Sep 17, 2009 at 10:45 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > After memory hotplug (or other events in future), kcore size
> > can be modified.
> >
> > To update inode->i_size, we have to know inode/dentry but we
> > can't get it from inside /proc directly.
> > But considerinyg memory hotplug, kcore image is updated only when
> > it's opened. Then, updating inode->i_size at open() is enough.
> >
> > Cc: WANG Cong <xiyou.wangcong@gmail.com>
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
>
> This patch looks fine.
>
> However, I am thinking if kcore is the only file under /proc whose size
> is changed dynamically? If no, that probably means we need to change
> generic proc code.
>
I tried yesteray, and back to this ;)
One thing which makes me confused is that there is no way to get
inode or dentry from proc_dir_entry.
I tried to rewrite proc_getattr() for cheating "ls". But it just works for
"stat" and inode->i_size is used more widely. So, this implementation now.
But considering practically, inode->i_size itself is not meaningful in /proc
files even if it's correct. For example, /proc/vmstat or /proc/stat,
/proc/<pid>/maps... etc...
inode->i_size will be dynamically changed while reading. Now, most of users
know regular files under /proc is not a "real" file and handle them in proper
way. (programs can be used with pipe/stdin works well.)
I wonder /proc/kcore is a special one, which gdb/objdump/readelf may access.
Above 3 programs are for "usual" files and not considering pseudo files under
/proc. So, I think adding generic i->i_size support is an overkill until
there are users depends on that.
Thanks,
-Kame
> Thanks!
>
> > ---
> > A fs/proc/kcore.c | A A 5 +++++
> > A 1 file changed, 5 insertions(+)
> >
> > Index: mmotm-2.6.31-Sep14/fs/proc/kcore.c
> > ===================================================================
> > --- mmotm-2.6.31-Sep14.orig/fs/proc/kcore.c
> > +++ mmotm-2.6.31-Sep14/fs/proc/kcore.c
> > @@ -546,6 +546,11 @@ static int open_kcore(struct inode *inod
> > A A A A A A A A return -EPERM;
> > A A A A if (kcore_need_update)
> > A A A A A A A A kcore_update_ram();
> > + A A A if (i_size_read(inode) != proc_root_kcore->size) {
> > + A A A A A A A mutex_lock(&inode->i_mutex);
> > + A A A A A A A i_size_write(inode, proc_root_kcore->size);
> > + A A A A A A A mutex_unlock(&inode->i_mutex);
> > + A A A }
> > A A A A return 0;
> > A }
> >
> >
> >
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-09-17 7:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 9:35 kcore patches (was Re: 2.6.32 -mm merge plans) Américo Wang
2009-09-16 11:17 ` KAMEZAWA Hiroyuki
2009-09-17 2:41 ` [PATCH 0/3][mmotm] showing size of kcore (Was " KAMEZAWA Hiroyuki
2009-09-17 2:42 ` [PATCH 1/3][mmotm] kcore: more fixes for init KAMEZAWA Hiroyuki
2009-09-17 5:55 ` Américo Wang
2009-09-17 2:44 ` [PATCH 2/3][mmotm] showing size of kcore KAMEZAWA Hiroyuki
2009-09-17 6:02 ` Américo Wang
2009-09-17 6:10 ` [PATCH 2/3][mmotm] showing size of kcore v2 KAMEZAWA Hiroyuki
2009-09-18 2:20 ` Américo Wang
2009-09-17 2:45 ` [PATCH 3/3][mmotm] updateing size of kcore KAMEZAWA Hiroyuki
2009-09-17 6:59 ` Américo Wang
2009-09-17 7:14 ` KAMEZAWA Hiroyuki [this message]
2009-09-18 2:05 ` Américo Wang
2009-09-17 3:09 ` kcore patches (was Re: 2.6.32 -mm merge plans) Américo Wang
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=20090917161432.97e06050.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=xiyou.wangcong@gmail.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