Messages in this thread | | | From | "Folkert van Heusden" <> | Subject | RE: TCP memory pressure question | Date | Sat, 23 Nov 2002 23:34:15 +0100 |
| |
> Any comments or suggestions are appreciated. I've found that when we hit TCP > memory pressure, many applications become very badly behaved.
What about:
int WRITE(int handle, char *whereto, int len) { int cnt=len;
while(len>0) { int rc;
rc = write(handle, whereto, len);
if (rc == -1) { if (errno == EINTR) { /* just try again */ } else if (errno == EAGAIN) { /* give up time-slice */ if (sched_yield() == -1) { /* BIG troubles */ syslog(LOG_DEBUG, "WRITE(), during EAGAIN handling: sched_yield failed! [%d - %s]", errno, strerror(errno)); return -1; } } else { syslog(LOG_DEBUG, "WRITE(): io-error [%d - %s]", errno, strerror(errno)); return -1; } } else if (rc == 0) { return 0; } else { whereto += rc; len -= rc; } }
return cnt; }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |