From owner-freebsd-current@FreeBSD.ORG Tue May 31 20:24:23 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 166EC1065695 for ; Tue, 31 May 2011 20:24:22 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 8AF548FC0C for ; Tue, 31 May 2011 20:24:22 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 81F587300B; Tue, 31 May 2011 22:21:42 +0200 (CEST) Date: Tue, 31 May 2011 22:21:42 +0200 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20110531202142.GA7105@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: "lazy" mmap for a device driver ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 31 May 2011 20:24:23 -0000 hi, i have a kernel module implementing a memory mapped special device which exports a large block of memory to the process. I see that when the process calls mmap(), my routine foo_mmap() is called immediately once per page, even though the process is not actually touching the pages. I believe this happens through dev_pager_alloc(). Right now i can live with that because all the memory is allocated at module load time, but i might want to have a sparse memory region which is populated dynamically, so i was wondering if there is a way to achieve this. I see there are two other device routines, d_mmap2 and d_mmap_single, any pointer to documentation or comments on how they differ ? thanks luigi