lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090714083344.626C.A69D9226@jp.fujitsu.com>
Date:	Tue, 14 Jul 2009 08:36:19 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	kosaki.motohiro@...fujitsu.com, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, fengguang.wu@...el.com,
	cl@...ux-foundation.org, riel@...hat.com
Subject: Re: [PATCH 3/4][resend]  Show kernel stack usage in /proc/meminfo and OOM log output

> On Mon, 13 Jul 2009 15:02:25 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@...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 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ