From owner-freebsd-current@FreeBSD.ORG Mon Jun 1 10:11:14 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7176B95 for ; Mon, 1 Jun 2015 10:11:14 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com [IPv6:2a00:1450:4010:c03::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64104150E for ; Mon, 1 Jun 2015 10:11:14 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by labko7 with SMTP id ko7so93860620lab.2 for ; Mon, 01 Jun 2015 03:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ZMiXRR6iJJYnBbWfkaDjqYjHphc+OhkWtvsnQQlyC1U=; b=LAly30joaMaONqrqJEqJUIk3FfMFmwsCEx7zArWqqDyf50i0fD8VY+KywdOIVrP5oY XtFcR2QGMeNEpOWX7Scz3cfbjphiSGgxOsOFznE/FZ4VmiOjkk/butntg0ztDj0rioLe 77BcbkS2ZE3QGnbvRtWdpRGGkK48PrFVYaNLazjKKILXgMjbFE3dqzNDTKbnRzF9th5J 78rDJP9xc/lq37AJLLdetVpkFI6o1lzgK7DqnGk44ijeDKTYamXN27k2oo9LVomyR5NV wnUrdoHR0rF/7KFi0PzGSUe9VvdT3wGWXgKX4dz7yJdAe4mT/o33LVfaSKcUkQBDYIp0 TUKg== MIME-Version: 1.0 X-Received: by 10.152.6.69 with SMTP id y5mr19954533lay.72.1433153472398; Mon, 01 Jun 2015 03:11:12 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.230.103 with HTTP; Mon, 1 Jun 2015 03:11:12 -0700 (PDT) In-Reply-To: <20150601115411.1f95bd00@x23> References: <20150601115411.1f95bd00@x23> Date: Mon, 1 Jun 2015 12:11:12 +0200 X-Google-Sender-Auth: _l0eGCASQu1gHPhsKkFXodGYyCY Message-ID: Subject: Re: superpages in FreeBSD (netmap related) ? From: Luigi Rizzo To: Marko Zec Cc: FreeBSD Current , Giuseppe Lettieri , Stefano Garzarella , Vincenzo Maffione , Luigi Rizzo Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2015 10:11:14 -0000 On Monday, June 1, 2015, Marko Zec wrote: > On Mon, 1 Jun 2015 11:34:00 +0200 > Luigi Rizzo > wrote: > > > Hi, > > i was wondering how we can improve the netmap memory allocator > > to make use of 2M pages (through the page promotion trick). > > > > in netmap, when we allocate packet buffers, > > we issue requests for 4k blocks to contigmalloc(), > > and i have no idea if there is a way to improve the > > chance that the memory is mapped to 2M pages ? > > In my (previous life) experience, when requested large enough blocks, > malloc() did a good job at automatically promoting those to superpages, > and in my applications this behavior was 100% consistent, at least on > amd64. After the block is allocated one can check whether it is > superpage-mapped: > > pmap_t pmap = vmspace_pmap(curthread->td_proc->p_vmspace); > > if (pmap_mincore(pmap, (vm_offset_t) addr) & MINCORE_SUPER) > /* you're good */ > else > /* bad luck */ Thanks. Do you know if there is any way to run some equivalente test from user space ? Cheers Luigi > OTOH I'm not aware of any mechanisms for forcing superpage allocations > at malloc() time. > > Marko > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------