From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 03:26:37 2011 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 6DAF81065675 for ; Tue, 15 Feb 2011 03:26:37 +0000 (UTC) (envelope-from beezarliu@yahoo.com.cn) Received: from nm10.bullet.mail.sp2.yahoo.com (nm10.bullet.mail.sp2.yahoo.com [98.139.91.80]) by mx1.freebsd.org (Postfix) with SMTP id 4A84B8FC24 for ; Tue, 15 Feb 2011 03:26:37 +0000 (UTC) Received: from [98.139.91.66] by nm10.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 Received: from [98.136.185.42] by tm6.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 Received: from [127.0.0.1] by smtp103.mail.gq1.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.cn; s=s1024; t=1297739583; bh=VHL7aKS16c0SuDxA0GpF3rBAwFNx6Os0Bifkfo0KUBw=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:References:Subject:Message-ID:X-mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=3QcKKaJ4xc/Uk2RHXjCABo4KqjvUfDK2EkrHyNGGEUXzlkmhnpv+eXAcWqZQzZ0KfOU1daZ5EwpP3nPFng8SU72GENIH6OMDoYFh6SVVJ72DNNFZaELxoCQKSUipqf11fs3RdzJaGvgOMyJmrdQiL9Yp+wIKxm9OGVFkR+/TTHA= X-Yahoo-Newman-Id: 285543.70097.bm@smtp103.mail.gq1.yahoo.com Received: from china (beezarliu@180.168.37.66 with login) by smtp103.mail.gq1.yahoo.com with SMTP; 14 Feb 2011 19:13:02 -0800 PST X-Yahoo-SMTP: YP5UPy2swBBHZGZlvbmOrntlD3fotw-- X-YMail-OSG: OLHu5UoVM1nXBtroIPGGU.yiu6KYO6wFd.KxamsswzT77oL cdQGn9IpeQphCzs8jvhsoHr.9pHvHA9EzFZpRi7tO.eZv06qgjfzaA9POBzH Oh9okDDzzK6OUZKwqm.MOBwUwlMx1mLk8oK1HUUSNhsDin.ZWkb2nV9x4JvQ x._EK5hfyVz8sSp.vdh4AE4DPZ4Gz3A7KALWvydLQhOrzwH7RcsoIXfF704r fJWL0h3dC7RsEX7N.VihYYNF3rORzGCRXibxWrclZIwLM.z.T41Vy9rQp3Ij 3oHgag9CyBewKj8oBFwuW_4Rc6Q1dnslnZZft2JDjKyRvI0upFDI- X-Yahoo-Newman-Property: ymail-3 Date: Tue, 15 Feb 2011 11:12:59 +0800 From: "beezarliu" To: "John Baldwin" , "freebsd-hackers@freebsd.org" References: <201102141718415933573@yahoo.com.cn>, <201102140939.17486.jhb@freebsd.org> Message-ID: <201102151112522035530@yahoo.com.cn> X-mailer: Foxmail 6, 10, 201, 20 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 15 Feb 2011 05:03:53 +0000 Cc: Subject: Re: Re: map share memory to kernel space 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: Tue, 15 Feb 2011 03:26:37 -0000 On 2011-02-14 22:56:28, John Baldwin wrote: >On Monday, February 14, 2011 4:18:50 am beezarliu wrote: >> Hackers, >> >> I want to access a userland share memory in a kernel thread. >> So I tried to map the share memory to the kernel space. >> The basic idea is to map the shm_object into kernel_map >> when the share memory is created. >> >> Using the following patch, I found the vm_object in kernel_map, >> and the vm_object in the address space of userland process are the same. >> But their content in the kernel and userland address mapped are different. >> >> It's very strang since they are exactly the same vm_object. >> Do I miss something, please help. > >Hmm, this is a bit of code I use for something similar to map a VM object into >the kernel. It does not use vm_page_grab() directly though: Initially, I wanted to allocate all the pages needed when the share memory is created, in order to reduce page fault at the time it's used. This seems to be an extra step. :( John, thank you very much! Beezar __________________________________________________ ¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä? http://cn.mail.yahoo.com