mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
The TCPPCAP debugging feature caches recently-used mbufs for use in
debugging TCP connections. This commit provides a mechanism to free those mbufs when the system is under memory pressure. Because this will result in lost debugging information, the behavior is controllable by a sysctl. The default setting is to free the mbufs. Reviewed by: gnn Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6931 Input from: novice_techie.com
This commit is contained in:
parent
7e12dfe5ef
commit
24b9bb5614
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302374
@ -42,9 +42,13 @@
|
||||
#define M_LEADINGSPACE_NOWRITE(m) \
|
||||
((m)->m_data - M_START(m))
|
||||
|
||||
int tcp_pcap_aggressive_free = 1;
|
||||
static int tcp_pcap_clusters_referenced_cur = 0;
|
||||
static int tcp_pcap_clusters_referenced_max = 0;
|
||||
|
||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcp_pcap_aggressive_free,
|
||||
CTLFLAG_RW, &tcp_pcap_aggressive_free, 0,
|
||||
"Free saved packets when the memory system comes under pressure");
|
||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcp_pcap_clusters_referenced_cur,
|
||||
CTLFLAG_RD, &tcp_pcap_clusters_referenced_cur, 0,
|
||||
"Number of clusters currently referenced on TCP PCAP queues");
|
||||
|
@ -36,4 +36,6 @@ void tcp_pcap_tcpcb_init(struct tcpcb *tp);
|
||||
void tcp_pcap_set_sock_max(struct mbufq *queue, int newval);
|
||||
int tcp_pcap_get_sock_max(struct mbufq *queue);
|
||||
|
||||
extern int tcp_pcap_aggressive_free;
|
||||
|
||||
#endif /* _NETINET_TCP_PCAP_H_ */
|
||||
|
@ -1605,6 +1605,13 @@ tcp_drain(void)
|
||||
if ((tcpb = intotcpcb(inpb)) != NULL) {
|
||||
tcp_reass_flush(tcpb);
|
||||
tcp_clean_sackreport(tcpb);
|
||||
#ifdef TCPPCAP
|
||||
if (tcp_pcap_aggressive_free) {
|
||||
/* Free the TCP PCAP queues. */
|
||||
tcp_pcap_drain(&(tcpb->t_inpkts));
|
||||
tcp_pcap_drain(&(tcpb->t_outpkts));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
INP_WUNLOCK(inpb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user