From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 3 23:22:25 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B666E106567A for ; Fri, 3 Dec 2010 23:22:25 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4A07D8FC1F for ; Fri, 3 Dec 2010 23:22:24 +0000 (UTC) Received: by wyf19 with SMTP id 19so10060589wyf.13 for ; Fri, 03 Dec 2010 15:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=vbZjiNNQQQJJ2SS+jf+6QymEkXc+YrSDp9NSdaIfnOw=; b=U7keeA0qXaqwC1+V8+gA+u/CvlSSz72lLAGF4t4Yk1JdT15DHLJadkCxAUUwI7Oi54 u9EfR1k13Jm5s3vxE39qolMsL75OZdt2g5OnlMD5PlF9a3NSXM6KrlvBj/EQQcuZwoMk bXYQKC8JXgSu1tvmr428CtevC+2pHRdhDwFX4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; b=tliMYn7+yLXEbWK7l41h3b6gkMORH26ZdoLrkCMQfbknTul8TVMizepIr3sn7Z/ksF qSPJZnmRXA25pEgjkwwXAbf4hs4meZtJdY4fiwvxx4DoirjWV2qbQVEWbdK2a3xdZVGO VuVZY4fk1ElZSyA/v8iZAVxCsuiMCppC8583Q= Received: by 10.216.50.72 with SMTP id y50mr2290080web.34.1291416995749; Fri, 03 Dec 2010 14:56:35 -0800 (PST) Received: from gumby.homeunix.com (bb-87-81-140-128.ukonline.co.uk [87.81.140.128]) by mx.google.com with ESMTPS id w41sm1154959weq.32.2010.12.03.14.56.33 (version=SSLv3 cipher=RC4-MD5); Fri, 03 Dec 2010 14:56:34 -0800 (PST) Date: Fri, 3 Dec 2010 22:56:31 +0000 From: RW To: freebsd-hackers@freebsd.org Message-ID: <20101203225631.4ec30063@gumby.homeunix.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.1; i386-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: MADV_FREE and vm_page_dontneed() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Dec 2010 23:22:25 -0000 Is there a good reason why physical memory pages released by madvise(...,MADV_FREE) get handled by vm_page_dontneed()? vm_page_dontneed() leaves page that are already in the inactive queue where they are, and otherwise distributes pages between the active queue, and the inactive queue's tail and head in the ratio 1:3:28. That seems reasonable for MADV_DONTNEED, but MADV_FREE pages are from freed dynamic memory, so passing them to vm_page_dontneed() leads to wasted pages building-up in the active and inactive queues. Wouldn't it make more sense to move all eligible MADV_FREE pages to the head of the inactive queue?