Date: Tue, 18 Jan 2011 17:20:51 -0800 From: Chuck Swiger <cswiger@mac.com> To: Mark Terribile <materribile@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: rusage and pthreads Message-ID: <76A5ACE2-12EB-4D5D-ABD8-E99B2DEEB5C8@mac.com> In-Reply-To: <35110.88084.qm@web110316.mail.gq1.yahoo.com> References: <35110.88084.qm@web110316.mail.gq1.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jan 18, 2011, at 5:01 PM, Mark Terribile wrote: > and continues further down > > ru = &td->td_ru; > ru->ru_ixrss += pgtok(vm->vm_tsize); > ru->ru_idrss += pgtok(vm->vm_dsize); > ru->ru_isrss += pgtok(vm->vm_ssize); > > This looks to me like it's accumulating the data in per-thread counters. What's more, it's consistent with what I'm seeing on the user side. Note that this is 7.2; if 8.x behaves differently I'd like to know. I wonder if all of the threads in a process might be pointing to the same struct rusage? Nope, checking kern/kern_resource.c kern_getrusage(), there is a per-proc struct rusage_ext which gets the sum of the per-thread td->td_ru counters via rufetch() / ruxagg()...so you're right that the counters are now per-thread. > Which would mean that a process that is occupying memory but doesn't happen to be running on that clock tick doesn't have its memory counted toward the total ... right? That's right. Regards, -- -Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?76A5ACE2-12EB-4D5D-ABD8-E99B2DEEB5C8>