[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090702094138.f86ead92.kamezawa.hiroyu@jp.fujitsu.com>
Date: Thu, 2 Jul 2009 09:41:38 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: ebiederm@...ssion.com (Eric W. Biederman),
Amerigo Wang <xiyou.wangcong@...il.com>, tao.ma@...cle.com,
linux-kernel@...r.kernel.org, adobriyan@...il.com,
mtk.manpages@...il.com, Yasunori Goto <y-goto@...fujitsu.com>
Subject: Re: [RESEND Patch] kcore: remove its pointless size
On Wed, 1 Jul 2009 17:12:49 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Wed, 01 Jul 2009 16:25:05 -0700 ebiederm@...ssion.com (Eric W. Biederman) wrote:
> > Which is better than showing a random number of dubious relationship
> > to the size we normally show. That code is just a maintenance problem.
>
> Well it's not just that st_size is wrong before the first read. It's
> also wrong after memory hot-add, up until the next read.
>
And I found kclist_add() is not called at memory hotplug...
> > > If so, should we run get_kcore_size() in proc_kcore_init(), perhaps?
> > >
> > > In fact, do we need to run get_kcore_size() more than once per boot?
> > >
> > > AFAICT we only run kclist_add() during bootup, so if proc_kcore_init()
> > > is called at the appropriate time, we can permanently cache its result?
> > >
> > > In which case get_kcore_size() and kclist_add() can be marked __init.
> > >
> > > Maybe that's all wrong - I didn't look terribly closely.
> >
> > Memory hot add I expect is the excuse. There is more that could be
> > done. But this patch is an obvious bit of chipping away nonsense
> > code.
>
> We have the infrastructure to get this right, I think:
>
> - run
>
> proc_root_kcore->size = get_kcore_size(...)
>
> within proc_kcore_init()
>
yes, seems sane.
> - register a memory-hotplug notifier and each time memory goes online
> or offline, rerun
>
> proc_root_kcore->size = get_kcore_size(...)
>
yes. and we need kclist_add() under memory hotplug.
> - stop running get_kcore_size() within read_kcore().
>
> I suspect that read_kcore() will not behave well if a memory hotplug
> operation happens concurrently. But that's a separate problem.
>
> (hopefully cc's some memory-hotplug people)
>
Maybe no problem. I don't think people does memory hotplug while he reads
/proc/kcore. (It sounds like modify coredump while investigating it.)
Thanks,
-Kame
>
> Or we just leave /proc/kcore's st_size at zero. It's a pretty hopeless
> exercise trying to get this "right", as nobody can safely _use_ that
> size - it can be wrong as soon as the caller has read from it.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists