<feed xmlns='http://www.w3.org/2005/Atom'>
<title>snowball/igloo-kernel.git/net/packet, branch u0</title>
<subtitle>Igloo kernel</subtitle>
<id>https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/atom?h=u0</id>
<link rel='self' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/atom?h=u0'/>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/'/>
<updated>2010-12-16T22:43:14+00:00</updated>
<entry>
<title>net: Use skb_checksum_start_offset()</title>
<updated>2010-12-16T22:43:14+00:00</updated>
<author>
<name>Michał Mirosław</name>
<email>mirq-linux@rere.qmqm.pl</email>
</author>
<published>2010-12-14T15:24:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=55508d601dab7df5cbcc7a63f4be8620eface204'/>
<id>urn:sha1:55508d601dab7df5cbcc7a63f4be8620eface204</id>
<content type='text'>
Replace skb-&gt;csum_start - skb_headroom(skb) with skb_checksum_start_offset().

Note for usb/smsc95xx: skb-&gt;data - skb-&gt;head == skb_headroom(skb).

Signed-off-by: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>af_packet: use swap() instead of the open coded macro XC()</title>
<updated>2010-12-11T00:02:20+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-12-11T00:02:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=c053fd96d0d3d18c721f880b8fdd0b925894d9c4'/>
<id>urn:sha1:c053fd96d0d3d18c721f880b8fdd0b925894d9c4</id>
<content type='text'>
Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>af_packet: fix freeing pg_vec twice on error path</title>
<updated>2010-12-08T18:43:41+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-12-07T05:05:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=920b8d913bd3d963d5c88bca160a272b71e0c95a'/>
<id>urn:sha1:920b8d913bd3d963d5c88bca160a272b71e0c95a</id>
<content type='text'>
It is introduced in:
        commit 0e3125c755445664f00ad036e4fc2cd32fd52877
        Author: Neil Horman &lt;nhorman@tuxdriver.com&gt;
        Date:   Tue Nov 16 10:26:47 2010 -0800

        packet: Enhance AF_PACKET implementation to not require high order contiguous memory allocation (v4)

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>af_packet: eliminate pgv_to_page on some arches</title>
<updated>2010-12-08T18:43:41+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-12-07T04:26:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=f6dafa95d1a48f73ab4a5b0f7dc0dcb72817e051'/>
<id>urn:sha1:f6dafa95d1a48f73ab4a5b0f7dc0dcb72817e051</id>
<content type='text'>
Some arches don't need flush_dcache_page(), and don't implement it, so
we can eliminate pgv_to_page() calls on those arches.

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>filter: constify sk_run_filter()</title>
<updated>2010-12-08T18:30:34+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-12-06T20:50:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=62ab0812137ec4f9884dd7de346238841ac03283'/>
<id>urn:sha1:62ab0812137ec4f9884dd7de346238841ac03283</id>
<content type='text'>
sk_run_filter() doesnt write on skb, change its prototype to reflect
this.

Fix two af_packet comments.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>af_packet: remove pgv.flags</title>
<updated>2010-12-06T20:59:07+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-12-01T02:52:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=c56b4d90123b77e29a91b9b96bb791f929139d8e'/>
<id>urn:sha1:c56b4d90123b77e29a91b9b96bb791f929139d8e</id>
<content type='text'>
As we can check if an address is vmalloc address with is_vmalloc_addr(),
we remove pgv.flags. Then we may get more pg_vecs.

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>af_packet: use vmalloc_to_page() instead for the addresss returned by vmalloc()</title>
<updated>2010-12-06T20:59:06+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-12-01T02:52:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=0af55bb58f8fa7865004ac48d16affe125ac1b7f'/>
<id>urn:sha1:0af55bb58f8fa7865004ac48d16affe125ac1b7f</id>
<content type='text'>
The following commit causes the pgv-&gt;buffer may point to the memory
returned by vmalloc(). And we can't use virt_to_page() for the vmalloc
address.

This patch introduces a new inline function pgv_to_page(), which calls
vmalloc_to_page() for the vmalloc address, and virt_to_page() for the
__get_free_pages address.

We used to increase page pointer to get the next page at the next page
address, after Neil's patch, it is wrong, as the physical address may
be not continuous. This patch also fixes this issue.

    commit 0e3125c755445664f00ad036e4fc2cd32fd52877
    Author: Neil Horman &lt;nhorman@tuxdriver.com&gt;
    Date:   Tue Nov 16 10:26:47 2010 -0800

    packet: Enhance AF_PACKET implementation to not require high order contiguous memory allocation (v4)

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>packet: use vzalloc()</title>
<updated>2010-11-21T18:01:42+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-11-20T07:31:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=bbce5a59e4e0e6e1dbc85492caaf310ff6611309'/>
<id>urn:sha1:bbce5a59e4e0e6e1dbc85492caaf310ff6611309</id>
<content type='text'>
alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
vzalloc() instead of vmalloc()

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>filter: optimize sk_run_filter</title>
<updated>2010-11-19T17:49:59+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-11-19T17:49:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=93aaae2e01e57483256b7da05c9a7ebd65ad4686'/>
<id>urn:sha1:93aaae2e01e57483256b7da05c9a7ebd65ad4686</id>
<content type='text'>
Remove pc variable to avoid arithmetic to compute fentry at each filter
instruction. Jumps directly manipulate fentry pointer.

As the last instruction of filter[] is guaranteed to be a RETURN, and
all jumps are before the last instruction, we dont need to check filter
bounds (number of instructions in filter array) at each iteration, so we
remove it from sk_run_filter() params.

On x86_32 remove f_k var introduced in commit 57fe93b374a6b871
(filter: make sure filters dont read uninitialized memory)

Note : We could use a CONFIG_ARCH_HAS_{FEW|MANY}_REGISTERS in order to
avoid too many ifdefs in this code.

This helps compiler to use cpu registers to hold fentry and A
accumulator.

On x86_32, this saves 401 bytes, and more important, sk_run_filter()
runs much faster because less register pressure (One less conditional
branch per BPF instruction)

# size net/core/filter.o net/core/filter_pre.o
   text    data     bss     dec     hex filename
   2948       0       0    2948     b84 net/core/filter.o
   3349       0       0    3349     d15 net/core/filter_pre.o

on x86_64 :
# size net/core/filter.o net/core/filter_pre.o
   text    data     bss     dec     hex filename
   5173       0       0    5173    1435 net/core/filter.o
   5224       0       0    5224    1468 net/core/filter_pre.o

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Acked-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>packet: Enhance AF_PACKET implementation to not require high order contiguous memory allocation (v4)</title>
<updated>2010-11-16T18:26:47+00:00</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2010-11-16T18:26:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.etezian.org/cgit.cgi/snowball/igloo-kernel.git/commit/?id=0e3125c755445664f00ad036e4fc2cd32fd52877'/>
<id>urn:sha1:0e3125c755445664f00ad036e4fc2cd32fd52877</id>
<content type='text'>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Version 4 of this patch.

Change notes:
1) Removed extra memset.  Didn't think kcalloc added a GFP_ZERO the way kzalloc did :)

Summary:
It was shown to me recently that systems under high load were driven very deep
into swap when tcpdump was run.  The reason this happened was because the
AF_PACKET protocol has a SET_RINGBUFFER socket option that allows the user space
application to specify how many entries an AF_PACKET socket will have and how
large each entry will be.  It seems the default setting for tcpdump is to set
the ring buffer to 32 entries of 64 Kb each, which implies 32 order 5
allocation.  Thats difficult under good circumstances, and horrid under memory
pressure.

I thought it would be good to make that a bit more usable.  I was going to do a
simple conversion of the ring buffer from contigous pages to iovecs, but
unfortunately, the metadata which AF_PACKET places in these buffers can easily
span a page boundary, and given that these buffers get mapped into user space,
and the data layout doesn't easily allow for a change to padding between frames
to avoid that, a simple iovec change is just going to break user space ABI
consistency.

So I've done this, I've added a three tiered mechanism to the af_packet set_ring
socket option.  It attempts to allocate memory in the following order:

1) Using __get_free_pages with GFP_NORETRY set, so as to fail quickly without
digging into swap

2) Using vmalloc

3) Using __get_free_pages with GFP_NORETRY clear, causing us to try as hard as
needed to get the memory

The effect is that we don't disturb the system as much when we're under load,
while still being able to conduct tcpdumps effectively.

Tested successfully by me.

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Acked-by: Maciej Żenczykowski &lt;zenczykowski@gmail.com&gt;
Reported-by: Maciej Żenczykowski &lt;zenczykowski@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
