lkml.org 
[lkml]   [2008]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH, RESEND2] getrusage: fill ru_maxrss value
On Wed, 17 Dec 2008 21:03:27 +0900 (JST)
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:

> > > > This patch makes ->ru_maxrss value in struct rusage filled accordingly to
> > > > rss hiwater mark. This struct is filled as a parameter to
> > > > getrusage syscall. ->ru_maxrss value is set to pages which might be correct
> > > > as "time" application converts it to KBs.
> > >
> > > Why?
> > > if kernel convert to KB, glibc don't need any change.
> > Where exactly glibc is working with this as KBs? I can't find that place.
> >
> > I looked into sources of time util and maxrss is showed this way:
> > fprintf (fp, "%lu", ptok ((UL) resp->ru.ru_maxrss));
> > ptok() actually does pages_to_KB conversion. If we convert to KB in
> > kernel, this code must be changed.
>
> Ah, you talked about /usr/bin/time? sorry, I misunderstood a bit.
> Why time need number of pages?
>
> In general, getrusage()::ru_maxrss is bsd compatibility feature.
> as far as possible, the same syscall spec is better.
> and bsd use KB unit.
Oh you are right. Now I searched it in FreeBSD kernel. They goes like this:
rss = pgtok(vmspace_resident_count(vm));
if (ru->ru_maxrss < rss)
ru->ru_maxrss = rss;

Seems pretty reasonable to stick with the same behavior. Then I really
do not understand why /usr/bin/time does the conversion.
FreeBSD /usr/bin/time is very different and much simpler and (of
course) does not do this conversion.

So I suggest to change the patch to fill KB instead of pages and
change /usr/bin/time to not do the conversion. What do you think?
>
> if time command has reasonable reason, I can agree current design.
> but is there?
>
>
>


\
 
 \ /
  Last update: 2008-12-17 15:55    [W:1.727 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site