From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: User switchable HW mappings & cie From: Benjamin Herrenschmidt In-Reply-To: References: <1160347065.5926.52.camel@localhost.localdomain> <452A35FF.50009@tungstengraphics.com> Content-Type: text/plain Date: Tue, 10 Oct 2006 07:06:23 +1000 Message-Id: <1160427983.7752.24.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Linus Torvalds Cc: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= , linux-mm@kvack.org, Linux Kernel list , Hugh Dickins , Arnd Bergmann List-ID: > Anyway, so right now you can use "vm_insert_page()" and it will increment > the page count and add things to the rmap lists, which is what current > users want. But if you don't have a normal page, you should be able to > basically avoid that part entirely, and just use > > set_pte_at(mm, addr, pte, make-up-a-pte-here); > > and you're done (of course, you need to use all the appropriate magic to > set up the pte, ie you'd normally have something like > > pte = get_locked_pte(mm, addr, &ptl); > .. > pte_unmap_unlock(pte, ptl); > > around it). Note that "vm_insert_page()" is _not_ for VM_PFNMAP mappings, > exactly because it does actually increment page counts. It's for a > "normal" mapping that just wants to insert a reference-counted page. Yes, that's why we want a vm_insert_pfn() as I really don't want to see PTE manipulations proliferate in drivers :) Nick is coming up with an implementation faster than I can think about the code anyway ;) Cheers, Ben. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org