From owner-freebsd-hackers@freebsd.org Sun Oct 14 22:42:29 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A6CC10C55D0 for ; Sun, 14 Oct 2018 22:42:29 +0000 (UTC) (envelope-from munro@penski.net) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B19D788B1 for ; Sun, 14 Oct 2018 22:42:28 +0000 (UTC) (envelope-from munro@penski.net) Received: by mail-ed1-x529.google.com with SMTP id g32-v6so16064193edg.13 for ; Sun, 14 Oct 2018 15:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ip9-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JhoGCNnjojkZgEkWlJnQGBtW6M+b+ywZZmJcLQrcgfY=; b=wPN3PEgHllhi9mWBJyzzmKXqC9x4aMKw2tBvipYmHKsZYASDZAQUVebWPfgWAQkQJY EKXqg2JUecluT3/AgusgfFznYCKQCxRskbDmue427/a2vQK76l5ubtXIdI2kSQ9x//76 oK1vM5CXWIQyMWbHmuslVezO2Gpv84+itVpU3TzlMAE7Ghpa05Cbeyeud7fZS3MGVedU ZWeyrTUPmwe6A1cYpZjPXJUCJBPQrO7qkMMPJGFv2WyVcuM+MDbowExt/Aa6fmYSiHz+ At4jTQPZq7RVsBXdN3kv5gkR9kcICFOKTe/bP/1lzCY5NFqmt/K4sjaxsyHVYi2Z0Lbw YPGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JhoGCNnjojkZgEkWlJnQGBtW6M+b+ywZZmJcLQrcgfY=; b=WBgR6KtsAOmcT3RuaCIGcZQRsju61oZM38KDSbptdM0U0HE5IgtMzExXY6hYYLXQ7w /66Ob2G3snfazMEPMNtHNczI/2Az73F8zHvZ2KmrqKUtKj+puaGuXSmGZfZnPZgJlGEv +dsx1uc7rLPpnpsOthsOp5Dikng+7YZdccLZ64lgw4AoG++65NQPyHApB5lgUENWtnQM 0o6Bk8+o/4EBfNuUebvxbnjQKxNh/i+YLO3d2FigXGqWd0nshziH1GB7NnPGU8CVeqgj 9QosjF4Hr1y9QiRqn2m68U0JnBEgNpE9D56yZB/c29w4BvbyiPvJSl3T677Y4l7YFlbV vM6A== X-Gm-Message-State: ABuFfohJ5kD/dM2Ni6BSRRzAu+x1TWg0eka/Ifvm7fRQiyfbOyETPFo5 vTUcsw5qPVaPHofb7g2ex9rqyz2ThLHjuzxytZrs0A== X-Google-Smtp-Source: ACcGV63KZwb96A4SXeBxwwzE+ftPvaHSiRfb1hXw6VQPRdcFehXuwBLEEG4jsCjUXMSv5+0MzlLLFxzQNzQabNCnH60= X-Received: by 2002:a50:9806:: with SMTP id g6-v6mr20793204edb.235.1539556947467; Sun, 14 Oct 2018 15:42:27 -0700 (PDT) MIME-Version: 1.0 References: <20181011001954.GV5335@kib.kiev.ua> <20181013235021.GX5335@kib.kiev.ua> <20181014114544.GA5335@kib.kiev.ua> <20181014223349.GA9022@raichu> In-Reply-To: <20181014223349.GA9022@raichu> From: Thomas Munro Date: Mon, 15 Oct 2018 11:42:15 +1300 Message-ID: Subject: Re: PostgresSQL vs super pages To: markj@freebsd.org Cc: Konstantin Belousov , alc@freebsd.org, freebsd-hackers@freebsd.org, mjg@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Oct 2018 22:42:29 -0000 On Mon, 15 Oct 2018 at 11:33, Mark Johnston wrote: > On Sun, Oct 14, 2018 at 02:45:44PM +0300, Konstantin Belousov wrote: > > On Sun, Oct 14, 2018 at 10:58:08PM +1300, Thomas Munro wrote: > > > Huh. Your program doesn't result in an S mapping on my laptop, but I > > > tried on an EC2 t2.2xlarge machine and there it promotes to S, even if > > > I comment out the write() loop (the loop that assigned to every byte > > > is enough). The difference might be the amount of memory on the > > > system: on my 4GB laptop, it is very reluctant to use super pages (but > > > I have seen it do it, so I know it can). On a 32GB system, it does it > > > immediately, and it works nicely for PostgreSQL too. So perhaps my > > > problem is testing on a small RAM system, though I don't understand > > > why. > > How many free memory does your system have ? Free as reported by top. If > > the free memory is low and fragmented, and I suppose it is on 4G laptop > > which you use with X, browser and other memory-consuming applications, > > system would have troubles filling the reverve, i.e reserving 2M of > > 2M-aligned physical pages. > > BTW, this can be explicitly verified with the sysctl vm.phys_free > sysctl. Superpage promotion requires free 2MB chunks from freelist 0, > pool 0. Ah, I see. Straight after rebooting without X I get super pages and vm.phys_free looks more healthy. I'd observed the same problem on other machines including servers with a bit (but not a lot) more memory, but clearly none of my FreeBSD systems are currently big enough to keep suitable chunks around on the freelist. I wonder if ZFS is a factor. Well, this was educational. Thanks very much for your help!