Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753745AbYLQOxd (ORCPT ); Wed, 17 Dec 2008 09:53:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751209AbYLQOxV (ORCPT ); Wed, 17 Dec 2008 09:53:21 -0500 Received: from mx2.redhat.com ([66.187.237.31]:55956 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbYLQOxU (ORCPT ); Wed, 17 Dec 2008 09:53:20 -0500 Date: Wed, 17 Dec 2008 15:52:39 +0100 From: Jiri Pirko To: KOSAKI Motohiro Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org, "Oleg Nesterov" , "Andrew Morton" , "Michael Kerrisk" , linux-api@vger.kernel.org, Hugh Dickins , jlim@sgi.com Subject: Re: [PATCH, RESEND2] getrusage: fill ru_maxrss value Message-ID: <20081217155239.77e58da0@psychotron.englab.brq.redhat.com> In-Reply-To: <20081217204607.FF25.KOSAKI.MOTOHIRO@jp.fujitsu.com> References: <20081217194646.F677.KOSAKI.MOTOHIRO@jp.fujitsu.com> <20081217124256.46883fae@psychotron.englab.brq.redhat.com> <20081217204607.FF25.KOSAKI.MOTOHIRO@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Dec 2008 21:03:27 +0900 (JST) KOSAKI Motohiro 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? > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/