Commit dfb6cbf6 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-delayed-wakeups'

Marcelo Ricardo Leitner says:

====================
sctp: delay calls to sk_data_ready() as much as possible

1st patch is a preparation for the 2nd. The idea is to not call
->sk_data_ready() for every data chunk processed while processing
packets but only once before releasing the socket.

v2: patchset re-checked, small changelog fixes
v3: on patch 2, make use of local vars to make it more readable
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ea019649 fb586f25
...@@ -210,14 +210,15 @@ struct sctp_sock { ...@@ -210,14 +210,15 @@ struct sctp_sock {
int user_frag; int user_frag;
__u32 autoclose; __u32 autoclose;
__u8 nodelay;
__u8 disable_fragments;
__u8 v4mapped;
__u8 frag_interleave;
__u32 adaptation_ind; __u32 adaptation_ind;
__u32 pd_point; __u32 pd_point;
__u8 recvrcvinfo; __u16 nodelay:1,
__u8 recvnxtinfo; disable_fragments:1,
v4mapped:1,
frag_interleave:1,
recvrcvinfo:1,
recvnxtinfo:1,
pending_data_ready:1;
atomic_t pd_mode; atomic_t pd_mode;
/* Receive to here while partial delivery is in effect. */ /* Receive to here while partial delivery is in effect. */
......
...@@ -1222,6 +1222,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, ...@@ -1222,6 +1222,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
sctp_cmd_seq_t *commands, sctp_cmd_seq_t *commands,
gfp_t gfp) gfp_t gfp)
{ {
struct sock *sk = ep->base.sk;
struct sctp_sock *sp = sctp_sk(sk);
int error = 0; int error = 0;
int force; int force;
sctp_cmd_t *cmd; sctp_cmd_t *cmd;
...@@ -1742,6 +1744,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, ...@@ -1742,6 +1744,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
error = sctp_outq_uncork(&asoc->outqueue, gfp); error = sctp_outq_uncork(&asoc->outqueue, gfp);
} else if (local_cork) } else if (local_cork)
error = sctp_outq_uncork(&asoc->outqueue, gfp); error = sctp_outq_uncork(&asoc->outqueue, gfp);
if (sp->pending_data_ready) {
sk->sk_data_ready(sk);
sp->pending_data_ready = 0;
}
return error; return error;
nomem: nomem:
error = -ENOMEM; error = -ENOMEM;
......
...@@ -264,7 +264,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event) ...@@ -264,7 +264,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
sctp_ulpq_clear_pd(ulpq); sctp_ulpq_clear_pd(ulpq);
if (queue == &sk->sk_receive_queue) if (queue == &sk->sk_receive_queue)
sk->sk_data_ready(sk); sctp_sk(sk)->pending_data_ready = 1;
return 1; return 1;
out_free: out_free:
...@@ -1140,5 +1140,5 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp) ...@@ -1140,5 +1140,5 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)
/* If there is data waiting, send it up the socket now. */ /* If there is data waiting, send it up the socket now. */
if (sctp_ulpq_clear_pd(ulpq) || ev) if (sctp_ulpq_clear_pd(ulpq) || ev)
sk->sk_data_ready(sk); sctp_sk(sk)->pending_data_ready = 1;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment