linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michael Kerrisk <mtk.manpages@googlemail.com>,
	linux-api@vger.kernel.org, Hugh Dickins <hugh@veritas.com>,
	jlim@sgi.com
Subject: Re: [PATCH, RESEND2] getrusage: fill ru_maxrss value
Date: Wed, 17 Dec 2008 15:52:39 +0100	[thread overview]
Message-ID: <20081217155239.77e58da0@psychotron.englab.brq.redhat.com> (raw)
In-Reply-To: <20081217204607.FF25.KOSAKI.MOTOHIRO@jp.fujitsu.com>

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?
> 
> 
> 

  reply	other threads:[~2008-12-17 14:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17  9:56 [PATCH, RESEND2] getrusage: fill ru_maxrss value Jiri Pirko
     [not found] ` <20081217105639.63e765eb-YzwxZg+R7evSU73v1vjTzyO4YDw3rz4rAInAS/Ez/D0@public.gmane.org>
2008-12-17 10:48   ` KOSAKI Motohiro
     [not found]     ` <20081217194646.F677.KOSAKI.MOTOHIRO-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-12-17 11:42       ` Jiri Pirko
     [not found]         ` <20081217124256.46883fae-YzwxZg+R7evSU73v1vjTzyO4YDw3rz4rAInAS/Ez/D0@public.gmane.org>
2008-12-17 12:03           ` KOSAKI Motohiro
2008-12-17 14:52             ` Jiri Pirko [this message]
2008-12-18  2:50               ` 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=20081217155239.77e58da0@psychotron.englab.brq.redhat.com \
    --to=jpirko@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hugh@veritas.com \
    --cc=jlim@sgi.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=oleg@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;
as well as URLs for NNTP newsgroup(s).