Date: Wed, 11 Nov 2015 23:39:47 +0000 From: "cameronsparr_gmail.com (Cameron Sparr)" <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] [Updated, 12 lines] D4129: Bug 204438 - setsockopt() handling of kern.ipc.maxsockbuf limit Message-ID: <85fc570f11f400cfa3e2cf3facea6f1a@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-nsgeoanyr2bjbgvnlcon-req@FreeBSD.org> References: <differential-rev-PHID-DREV-nsgeoanyr2bjbgvnlcon-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] cameronsparr_gmail.com removed rS FreeBSD src repository as the repository for this revision. cameronsparr_gmail.com updated this revision to Diff 10121. cameronsparr_gmail.com added a comment. spaces to tabs CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D4129?vs=10120&id=10121 REVISION DETAIL https://reviews.freebsd.org/D4129 AFFECTED FILES sys/kern/uipc_sockbuf.c CHANGE DETAILS diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -397,7 +397,7 @@ sb_max_adj = (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES); return (0); } - + /* * Allot mbufs to a sockbuf. Attempt to scale mbmax so that mbcnt doesn't * become limiting if buffering efficiency is near the normal case. @@ -417,8 +417,12 @@ * appropriate thread resource limits are available. In that case, * we don't apply a process limit. */ - if (cc > sb_max_adj) + if (cc > sb_max) return (0); + + if (cc > sb_max_adj) + cc = sb_max_adj; + if (td != NULL) { sbsize_limit = lim_cur(td, RLIMIT_SBSIZE); } else @@ -433,7 +437,7 @@ } int -sbreserve(struct sockbuf *sb, u_long cc, struct socket *so, +sbreserve(struct sockbuf *sb, u_long cc, struct socket *so, struct thread *td) { int error; @@ -1297,7 +1301,7 @@ xsb->sb_cc = sb->sb_ccc; xsb->sb_hiwat = sb->sb_hiwat; xsb->sb_mbcnt = sb->sb_mbcnt; - xsb->sb_mcnt = sb->sb_mcnt; + xsb->sb_mcnt = sb->sb_mcnt; xsb->sb_ccnt = sb->sb_ccnt; xsb->sb_mbmax = sb->sb_mbmax; xsb->sb_lowat = sb->sb_lowat; EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: cameronsparr_gmail.com, Contributor Reviewers, network Cc: freebsd-net-list, imp [-- Attachment #2 --] diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -397,7 +397,7 @@ sb_max_adj = (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES); return (0); } - + /* * Allot mbufs to a sockbuf. Attempt to scale mbmax so that mbcnt doesn't * become limiting if buffering efficiency is near the normal case. @@ -417,8 +417,12 @@ * appropriate thread resource limits are available. In that case, * we don't apply a process limit. */ - if (cc > sb_max_adj) + if (cc > sb_max) return (0); + + if (cc > sb_max_adj) + cc = sb_max_adj; + if (td != NULL) { sbsize_limit = lim_cur(td, RLIMIT_SBSIZE); } else @@ -433,7 +437,7 @@ } int -sbreserve(struct sockbuf *sb, u_long cc, struct socket *so, +sbreserve(struct sockbuf *sb, u_long cc, struct socket *so, struct thread *td) { int error; @@ -1297,7 +1301,7 @@ xsb->sb_cc = sb->sb_ccc; xsb->sb_hiwat = sb->sb_hiwat; xsb->sb_mbcnt = sb->sb_mbcnt; - xsb->sb_mcnt = sb->sb_mcnt; + xsb->sb_mcnt = sb->sb_mcnt; xsb->sb_ccnt = sb->sb_ccnt; xsb->sb_mbmax = sb->sb_mbmax; xsb->sb_lowat = sb->sb_lowat;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85fc570f11f400cfa3e2cf3facea6f1a>
