aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-07-31 19:44:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 21:42:46 -0400
commit99a1dec70d5acbd8c6b3928cdebb4a2d1da676c8 (patch)
treeac61a8b479065fa3ed3fdddf17e91366dcddcea5 /net
parent183f6371aac2a5496a8ef2b0b0a68562652c3cdb (diff)
net: introduce sk_gfp_atomic() to allow addition of GFP flags depending on the individual socket
Introduce sk_gfp_atomic(), this function allows to inject sock specific flags to each sock related allocation. It is only used on allocation paths that may be required for writing pages back to network storage. [davem@davemloft.net: Use sk_gfp_atomic only when necessary] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Mel Gorman <mgorman@suse.de> Acked-by: David S. Miller <davem@davemloft.net> Cc: Neil Brown <neilb@suse.de> Cc: Mike Christie <michaelc@cs.wisc.edu> Cc: Eric B Munson <emunson@mgebm.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Cc: Mel Gorman <mgorman@suse.de> Cc: Christoph Lameter <cl@linux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_output.c12
-rw-r--r--net/ipv6/tcp_ipv6.c8
2 files changed, 12 insertions, 8 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 33cd065cfbd..3f1bcff0b10 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2045,7 +2045,8 @@ void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
2045 if (unlikely(sk->sk_state == TCP_CLOSE)) 2045 if (unlikely(sk->sk_state == TCP_CLOSE))
2046 return; 2046 return;
2047 2047
2048 if (tcp_write_xmit(sk, cur_mss, nonagle, 0, GFP_ATOMIC)) 2048 if (tcp_write_xmit(sk, cur_mss, nonagle, 0,
2049 sk_gfp_atomic(sk, GFP_ATOMIC)))
2049 tcp_check_probe_timer(sk); 2050 tcp_check_probe_timer(sk);
2050} 2051}
2051 2052
@@ -2666,7 +2667,8 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
2666 2667
2667 if (cvp != NULL && cvp->s_data_constant && cvp->s_data_desired) 2668 if (cvp != NULL && cvp->s_data_constant && cvp->s_data_desired)
2668 s_data_desired = cvp->s_data_desired; 2669 s_data_desired = cvp->s_data_desired;
2669 skb = alloc_skb(MAX_TCP_HEADER + 15 + s_data_desired, GFP_ATOMIC); 2670 skb = alloc_skb(MAX_TCP_HEADER + 15 + s_data_desired,
2671 sk_gfp_atomic(sk, GFP_ATOMIC));
2670 if (unlikely(!skb)) { 2672 if (unlikely(!skb)) {
2671 dst_release(dst); 2673 dst_release(dst);
2672 return NULL; 2674 return NULL;
@@ -3064,7 +3066,7 @@ void tcp_send_ack(struct sock *sk)
3064 * tcp_transmit_skb() will set the ownership to this 3066 * tcp_transmit_skb() will set the ownership to this
3065 * sock. 3067 * sock.
3066 */ 3068 */
3067 buff = alloc_skb(MAX_TCP_HEADER, GFP_ATOMIC); 3069 buff = alloc_skb(MAX_TCP_HEADER, sk_gfp_atomic(sk, GFP_ATOMIC));
3068 if (buff == NULL) { 3070 if (buff == NULL) {
3069 inet_csk_schedule_ack(sk); 3071 inet_csk_schedule_ack(sk);
3070 inet_csk(sk)->icsk_ack.ato = TCP_ATO_MIN; 3072 inet_csk(sk)->icsk_ack.ato = TCP_ATO_MIN;
@@ -3079,7 +3081,7 @@ void tcp_send_ack(struct sock *sk)
3079 3081
3080 /* Send it off, this clears delayed acks for us. */ 3082 /* Send it off, this clears delayed acks for us. */
3081 TCP_SKB_CB(buff)->when = tcp_time_stamp; 3083 TCP_SKB_CB(buff)->when = tcp_time_stamp;
3082 tcp_transmit_skb(sk, buff, 0, GFP_ATOMIC); 3084 tcp_transmit_skb(sk, buff, 0, sk_gfp_atomic(sk, GFP_ATOMIC));
3083} 3085}
3084 3086
3085/* This routine sends a packet with an out of date sequence 3087/* This routine sends a packet with an out of date sequence
@@ -3099,7 +3101,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent)
3099 struct sk_buff *skb; 3101 struct sk_buff *skb;
3100 3102
3101 /* We don't queue it, tcp_transmit_skb() sets ownership. */ 3103 /* We don't queue it, tcp_transmit_skb() sets ownership. */
3102 skb = alloc_skb(MAX_TCP_HEADER, GFP_ATOMIC); 3104 skb = alloc_skb(MAX_TCP_HEADER, sk_gfp_atomic(sk, GFP_ATOMIC));
3103 if (skb == NULL) 3105 if (skb == NULL)
3104 return -1; 3106 return -1;
3105 3107
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 61c7b6d8317..c66b90f71c9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1299,7 +1299,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1299 /* Clone pktoptions received with SYN */ 1299 /* Clone pktoptions received with SYN */
1300 newnp->pktoptions = NULL; 1300 newnp->pktoptions = NULL;
1301 if (treq->pktopts != NULL) { 1301 if (treq->pktopts != NULL) {
1302 newnp->pktoptions = skb_clone(treq->pktopts, GFP_ATOMIC); 1302 newnp->pktoptions = skb_clone(treq->pktopts,
1303 sk_gfp_atomic(sk, GFP_ATOMIC));
1303 consume_skb(treq->pktopts); 1304 consume_skb(treq->pktopts);
1304 treq->pktopts = NULL; 1305 treq->pktopts = NULL;
1305 if (newnp->pktoptions) 1306 if (newnp->pktoptions)
@@ -1349,7 +1350,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1349 * across. Shucks. 1350 * across. Shucks.
1350 */ 1351 */
1351 tcp_md5_do_add(newsk, (union tcp_md5_addr *)&newnp->daddr, 1352 tcp_md5_do_add(newsk, (union tcp_md5_addr *)&newnp->daddr,
1352 AF_INET6, key->key, key->keylen, GFP_ATOMIC); 1353 AF_INET6, key->key, key->keylen,
1354 sk_gfp_atomic(sk, GFP_ATOMIC));
1353 } 1355 }
1354#endif 1356#endif
1355 1357
@@ -1442,7 +1444,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1442 --ANK (980728) 1444 --ANK (980728)
1443 */ 1445 */
1444 if (np->rxopt.all) 1446 if (np->rxopt.all)
1445 opt_skb = skb_clone(skb, GFP_ATOMIC); 1447 opt_skb = skb_clone(skb, sk_gfp_atomic(sk, GFP_ATOMIC));
1446 1448
1447 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1449 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
1448 sock_rps_save_rxhash(sk, skb); 1450 sock_rps_save_rxhash(sk, skb);