Commit 0e28f14f authored by David S. Miller's avatar David S. Miller

Make sock_writeable (used mostly by datagram

protocols) more reasonable.  Kill all references
to SOCK_MIN_WRITE_SPACE and kill its definition.
Replace with appropriate sock_writeable calls.
parent 44303b29
......@@ -750,16 +750,13 @@ static inline void sk_wake_async(struct sock *sk, int how, int band)
#define SOCK_MIN_SNDBUF 2048
#define SOCK_MIN_RCVBUF 256
/* Must be less or equal SOCK_MIN_SNDBUF */
#define SOCK_MIN_WRITE_SPACE SOCK_MIN_SNDBUF
/*
* Default write policy as shown to user space via poll/select/SIGIO
* Kernel internally doesn't use the MIN_WRITE_SPACE threshold.
*/
static inline int sock_writeable(struct sock *sk)
{
return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE;
return atomic_read(&sk->wmem_alloc) < (sk->sndbuf / 2);
}
static inline int gfp_any(void)
......
......@@ -1700,7 +1700,7 @@ static unsigned int irda_poll(struct file * file, struct socket *sock,
if (sk->state == TCP_ESTABLISHED) {
if ((self->tx_flow == FLOW_START) &&
(sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE))
sock_writeable(sk))
{
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
}
......@@ -1708,13 +1708,13 @@ static unsigned int irda_poll(struct file * file, struct socket *sock,
break;
case SOCK_SEQPACKET:
if ((self->tx_flow == FLOW_START) &&
(sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE))
sock_writeable(sk))
{
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
}
break;
case SOCK_DGRAM:
if (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE)
if (sock_writeable(sk))
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
break;
default:
......
......@@ -67,9 +67,6 @@
#include <asm/uaccess.h>
/* Following value should be > 32k + RPC overhead */
#define XPRT_MIN_WRITE_SPACE (35000 + SOCK_MIN_WRITE_SPACE)
extern spinlock_t rpc_queue_lock;
/*
......@@ -1099,9 +1096,8 @@ udp_write_space(struct sock *sk)
if (xprt->shutdown)
return;
/* Wait until we have enough socket memory */
if (sock_wspace(sk) < min_t(int, sk->sndbuf,XPRT_MIN_WRITE_SPACE))
/* Wait until we have enough socket memory. */
if (sock_writeable(sk))
return;
if (!xprt_test_and_set_wspace(xprt)) {
......
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