From owner-freebsd-hackers@freebsd.org Fri Nov 18 11:12:27 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 006FCC48BF6 for ; Fri, 18 Nov 2016 11:12:27 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id BF1A31DBC for ; Fri, 18 Nov 2016 11:12:26 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 685FEAA57; Fri, 18 Nov 2016 11:12:19 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id BC2184129; Fri, 18 Nov 2016 12:12:09 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Matthias Andree Cc: freebsd-hackers@FreeBSD.org, Mark Linimon Subject: Re: sbrk(0) replacement for memory resource tracking? References: <20161110012624.GA23701@lonesome.com> Date: Fri, 18 Nov 2016 12:12:09 +0100 In-Reply-To: (Matthias Andree's message of "Thu, 10 Nov 2016 22:21:18 +0100") Message-ID: <86oa1dujna.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2016 11:12:27 -0000 Matthias Andree writes: > OTOH, e2fsprogs uses only sbrk(0) to track its overall memory use, and > only to track its resource usage. I'll be happy to help porting to > something else that serves the same purpose, aka "how much memory am I > using" - but what would that be? Ideally, the realization that the numbers you get from sbrk() are completely meaningless, followed by removal of that code. And I don't just mean that they're meaningless because jemalloc() uses mmap() - they were meaningless before jemalloc(), because they only tell you how much address space the program has allocated, not how much of it is actually in use. And even if it did, it wouldn't tell you anything about memory pressure, how much of the program's memory is swapped out, etc. It's like asking how long a road is and then claiming to know where you are based on that answer. You don't - all you know is how far you could have gone without a break if you'd started at one end and kept going. And for all you know, there may be a section that's closed for repairs. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no