Re: [PATCH 21/62] net: remove the second argument ofk[un]map_atomic()

From: Eric Dumazet
Date: Mon Nov 28 2011 - 13:26:48 EST


Le lundi 28 novembre 2011 Ã 10:06 -0800, Alexander Duyck a Ãcrit :
> On 11/27/2011 12:07 AM, Eric Dumazet wrote:
> > But why are these drivers using kmap_atomic() in first place, since
> > their fragments are allocated in regular zone (GFP_ATOMIC or
> > GFP_KERNEL) ?
>
> I was asking the same thing myself recently when I started working on
> some copy-break like code for the ixgbe driver. I believe the main
> reason is a lack of documentation. This code is based loosely on the
> skb_copy_bits code which will use kmap_skb_frag over all of the paged
> portions of the sk_buff. As such it was decided to map things via
> kmap_atomic in order to guarantee the pages had a valid virtual address.
>
> If I understand things correctly, what you are brining up is that pages
> allocated with either GFP_ATOMIC or GFP_KERNEL will always be allocated
> from the lowmem pool and as such page_address should always succeed. Is
> that correct?
>

Yes.

Either you could :

A) allocate high memory pages to lower pressure on LOWMEM area on 32bit
kernels.

B) avoid using kmap_atomic() & kunmap_atomic() and be faster on 32bit
kernels.

skb_put(skb, length);
memcpy(skb->data, page_address(buffer_info->page), length);





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/