diff options
author | David S. Miller <davem@davemloft.net> | 2014-09-08 00:41:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-08 00:41:53 -0400 |
commit | eb84d6b60491a3ca3d90d62ee5346b007770d40d (patch) | |
tree | 22aadf9ada15e1ae5ba4c400aafab6f2541996e6 /net/core/sock.c | |
parent | 97a13e5289baa96eaddd06e61d277457d837af3a (diff) | |
parent | d030671f3f261e528dc6e396a13f10859a74ae7c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 69592cb66e3b..6f436b5e4961 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(sk_ns_capable); | |||
166 | /** | 166 | /** |
167 | * sk_capable - Socket global capability test | 167 | * sk_capable - Socket global capability test |
168 | * @sk: Socket to use a capability on or through | 168 | * @sk: Socket to use a capability on or through |
169 | * @cap: The global capbility to use | 169 | * @cap: The global capability to use |
170 | * | 170 | * |
171 | * Test to see if the opener of the socket had when the socket was | 171 | * Test to see if the opener of the socket had when the socket was |
172 | * created and the current process has the capability @cap in all user | 172 | * created and the current process has the capability @cap in all user |
@@ -183,7 +183,7 @@ EXPORT_SYMBOL(sk_capable); | |||
183 | * @sk: Socket to use a capability on or through | 183 | * @sk: Socket to use a capability on or through |
184 | * @cap: The capability to use | 184 | * @cap: The capability to use |
185 | * | 185 | * |
186 | * Test to see if the opener of the socket had when the socke was created | 186 | * Test to see if the opener of the socket had when the socket was created |
187 | * and the current process has the capability @cap over the network namespace | 187 | * and the current process has the capability @cap over the network namespace |
188 | * the socket is a member of. | 188 | * the socket is a member of. |
189 | */ | 189 | */ |
@@ -1820,6 +1820,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, | |||
1820 | order); | 1820 | order); |
1821 | if (page) | 1821 | if (page) |
1822 | goto fill_page; | 1822 | goto fill_page; |
1823 | /* Do not retry other high order allocations */ | ||
1824 | order = 1; | ||
1825 | max_page_order = 0; | ||
1823 | } | 1826 | } |
1824 | order--; | 1827 | order--; |
1825 | } | 1828 | } |
@@ -1867,10 +1870,8 @@ EXPORT_SYMBOL(sock_alloc_send_skb); | |||
1867 | * no guarantee that allocations succeed. Therefore, @sz MUST be | 1870 | * no guarantee that allocations succeed. Therefore, @sz MUST be |
1868 | * less or equal than PAGE_SIZE. | 1871 | * less or equal than PAGE_SIZE. |
1869 | */ | 1872 | */ |
1870 | bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) | 1873 | bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) |
1871 | { | 1874 | { |
1872 | int order; | ||
1873 | |||
1874 | if (pfrag->page) { | 1875 | if (pfrag->page) { |
1875 | if (atomic_read(&pfrag->page->_count) == 1) { | 1876 | if (atomic_read(&pfrag->page->_count) == 1) { |
1876 | pfrag->offset = 0; | 1877 | pfrag->offset = 0; |
@@ -1881,20 +1882,21 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) | |||
1881 | put_page(pfrag->page); | 1882 | put_page(pfrag->page); |
1882 | } | 1883 | } |
1883 | 1884 | ||
1884 | order = SKB_FRAG_PAGE_ORDER; | 1885 | pfrag->offset = 0; |
1885 | do { | 1886 | if (SKB_FRAG_PAGE_ORDER) { |
1886 | gfp_t gfp = prio; | 1887 | pfrag->page = alloc_pages(gfp | __GFP_COMP | |
1887 | 1888 | __GFP_NOWARN | __GFP_NORETRY, | |
1888 | if (order) | 1889 | SKB_FRAG_PAGE_ORDER); |
1889 | gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; | ||
1890 | pfrag->page = alloc_pages(gfp, order); | ||
1891 | if (likely(pfrag->page)) { | 1890 | if (likely(pfrag->page)) { |
1892 | pfrag->offset = 0; | 1891 | pfrag->size = PAGE_SIZE << SKB_FRAG_PAGE_ORDER; |
1893 | pfrag->size = PAGE_SIZE << order; | ||
1894 | return true; | 1892 | return true; |
1895 | } | 1893 | } |
1896 | } while (--order >= 0); | 1894 | } |
1897 | 1895 | pfrag->page = alloc_page(gfp); | |
1896 | if (likely(pfrag->page)) { | ||
1897 | pfrag->size = PAGE_SIZE; | ||
1898 | return true; | ||
1899 | } | ||
1898 | return false; | 1900 | return false; |
1899 | } | 1901 | } |
1900 | EXPORT_SYMBOL(skb_page_frag_refill); | 1902 | EXPORT_SYMBOL(skb_page_frag_refill); |