public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kernel vaddr -> struct page
@ 2002-10-17 19:11 Eric Barton
  2002-10-17 19:24 ` Brian Gerst
  2002-10-17 20:22 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Barton @ 2002-10-17 19:11 UTC (permalink / raw)
  To: linux-kernel


Hi,

I'm trying to turn a kernel virtual address into a struct page that I can
then pass to tcp_sendpage().  

The kernel virtual address could be {kmalloc(),vmalloc(),kmap()}-ed memory,
and I guarantee that this memory will not be {kfree(),vfree(),kunmap()}-ed
until the socket has done with the page (i.e. all the data has been acked).

I'd have thought that vmalloc_to_page(kvaddr) should give me a page I could
use, since it is walking the page tables to find the pte for 'kvaddr', and
checking that the physical page is present.

However I find I'm sending garbage when I use this method.

Can anyone help me understand?

-- 

                Cheers,
                        Eric

----------------------------------------------------
|Eric Barton        Barton Software                |
|9 York Gardens     Tel:    +44 (117) 330 1575     |
|Clifton            Mobile: +44 (7909) 680 356     |
|Bristol BS8 4LL    Fax:    call first             |
|United Kingdom     E-Mail: eric@bartonsoftware.com|
----------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kernel vaddr -> struct page
  2002-10-17 19:11 kernel vaddr -> struct page Eric Barton
@ 2002-10-17 19:24 ` Brian Gerst
  2002-10-17 20:24   ` David S. Miller
  2002-10-17 20:22 ` David S. Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Gerst @ 2002-10-17 19:24 UTC (permalink / raw)
  To: Eric Barton; +Cc: linux-kernel

Eric Barton wrote:
> Hi,
> 
> I'm trying to turn a kernel virtual address into a struct page that I can
> then pass to tcp_sendpage().  
> 
> The kernel virtual address could be {kmalloc(),vmalloc(),kmap()}-ed memory,
> and I guarantee that this memory will not be {kfree(),vfree(),kunmap()}-ed
> until the socket has done with the page (i.e. all the data has been acked).
> 
> I'd have thought that vmalloc_to_page(kvaddr) should give me a page I could
> use, since it is walking the page tables to find the pte for 'kvaddr', and
> checking that the physical page is present.
> 
> However I find I'm sending garbage when I use this method.
> 
> Can anyone help me understand?
> 

virt_to_page()

--
				Brian Gerst


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kernel vaddr -> struct page
  2002-10-17 19:11 kernel vaddr -> struct page Eric Barton
  2002-10-17 19:24 ` Brian Gerst
@ 2002-10-17 20:22 ` David S. Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2002-10-17 20:22 UTC (permalink / raw)
  To: eric; +Cc: linux-kernel


vmalloc_to_page() does not work on kmalloc/kmap'd memory.

On many system kmalloc memory is not even represented in the
page tables because the mapping goes through a direct bypass
window.

You need to know where the object came from to convert it
into a page properly.  You should be allocating and passing
around pages internally anyways.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kernel vaddr -> struct page
  2002-10-17 19:24 ` Brian Gerst
@ 2002-10-17 20:24   ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2002-10-17 20:24 UTC (permalink / raw)
  To: bgerst; +Cc: eric, linux-kernel

   From: Brian Gerst <bgerst@didntduck.org>
   Date: Thu, 17 Oct 2002 15:24:49 -0400

   virt_to_page()
   
Doesn't work on vmalloc() data, he said that was a possibility for his
case.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-17 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-17 19:11 kernel vaddr -> struct page Eric Barton
2002-10-17 19:24 ` Brian Gerst
2002-10-17 20:24   ` David S. Miller
2002-10-17 20:22 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox