From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, fengguang.wu@intel.com,
cl@linux-foundation.org, riel@redhat.com
Subject: Re: [PATCH 3/4][resend] Show kernel stack usage in /proc/meminfo and OOM log output
Date: Tue, 14 Jul 2009 08:36:19 +0900 (JST) [thread overview]
Message-ID: <20090714083344.626C.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20090713152952.9b1f6388.akpm@linux-foundation.org>
> On Mon, 13 Jul 2009 15:02:25 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
> > ChangeLog
> > Since v1
> > - Rewrote the descriptin (Thanks Christoph!)
> >
> > =====================
> > Subject: [PATCH] Show kernel stack usage in /proc/meminfo and OOM log output
> >
> > The amount of memory allocated to kernel stacks can become significant and
> > cause OOM conditions. However, we do not display the amount of memory
> > consumed by stacks.
> >
> > Add code to display the amount of memory used for stacks in /proc/meminfo.
> >
> > ...
> >
> > +static void account_kernel_stack(struct thread_info *ti, int account)
> > +{
> > + struct zone *zone = page_zone(virt_to_page(ti));
> > +
> > + mod_zone_page_state(zone, NR_KERNEL_STACK, account);
> > +}
> > +
> > void free_task(struct task_struct *tsk)
> > {
> > prop_local_destroy_single(&tsk->dirties);
> > + account_kernel_stack(tsk->stack, -1);
>
> But surely there are other less expensive ways of calculating this.
> The number we want is small-known-constant * number-of-tasks.
>
> number-of-tasks probably isn't tracked, but can be calculated along the
> lines of nr_running(), nr_uninterruptible() and nr_iowait().
But, nr_running() don't know zone information. we really need
per-zone tracking IMHO.
> number-of-tasks is also equal to number-of-task_structs and
> number-of_thread_infos which can be obtained from slab (if the arch
> implemented these via slab - uglier).
You know, Almost architecture doesn't use slab for kernel-stack.
--
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-07-13 23:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 5:57 [PATCH 0/4] OOM analysis helper patch series v3 KOSAKI Motohiro
2009-07-13 6:00 ` [PATCH 1/4][resend] add per-zone statistics to show_free_areas() KOSAKI Motohiro
2009-07-13 6:01 ` [PATCH 2/4][resend] add buffer cache information " KOSAKI Motohiro
2009-07-13 6:02 ` [PATCH 3/4][resend] Show kernel stack usage in /proc/meminfo and OOM log output KOSAKI Motohiro
2009-07-13 22:29 ` Andrew Morton
2009-07-13 23:36 ` KOSAKI Motohiro [this message]
2009-07-13 6:05 ` [PATCH 4/4][resend] add shmem vmstat KOSAKI Motohiro
2009-07-13 20:47 ` [PATCH 0/4] OOM analysis helper patch series v3 Rik van Riel
2009-07-13 23:38 ` KOSAKI Motohiro
2009-07-14 18:47 ` Li, Ming Chun
2009-07-14 23:38 ` KOSAKI Motohiro
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=20090714083344.626C.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.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