Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Rename m_reclaim -> mb_drain, and localify.
details: https://anonhg.NetBSD.org/src/rev/b978030a3c74
branches: trunk
changeset: 318499:b978030a3c74
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Apr 27 07:41:58 2018 +0000
description:
Rename m_reclaim -> mb_drain, and localify.
diffstat:
sys/kern/uipc_mbuf.c | 81 ++++++++++++++++++++++++++-------------------------
sys/sys/mbuf.h | 3 +-
2 files changed, 42 insertions(+), 42 deletions(-)
diffs (140 lines):
diff -r ce18d10135d6 -r b978030a3c74 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c Fri Apr 27 07:20:33 2018 +0000
+++ b/sys/kern/uipc_mbuf.c Fri Apr 27 07:41:58 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_mbuf.c,v 1.202 2018/04/27 07:20:33 maxv Exp $ */
+/* $NetBSD: uipc_mbuf.c,v 1.203 2018/04/27 07:41:58 maxv Exp $ */
/*
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.202 2018/04/27 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.203 2018/04/27 07:41:58 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_mbuftrace.h"
@@ -96,6 +96,7 @@
int max_hdr;
int max_datalen;
+static void mb_drain(void *, int);
static int mb_ctor(void *, void *, int);
static void sysctl_kern_mbuf_setup(void);
@@ -191,8 +192,8 @@
IPL_VM, NULL, NULL, NULL);
KASSERT(mcl_cache != NULL);
- pool_cache_set_drain_hook(mb_cache, m_reclaim, NULL);
- pool_cache_set_drain_hook(mcl_cache, m_reclaim, NULL);
+ pool_cache_set_drain_hook(mb_cache, mb_drain, NULL);
+ pool_cache_set_drain_hook(mcl_cache, mb_drain, NULL);
/*
* Set an arbitrary default limit on the number of mbuf clusters.
@@ -237,6 +238,42 @@
#endif
}
+static void
+mb_drain(void *arg, int flags)
+{
+ struct domain *dp;
+ const struct protosw *pr;
+ struct ifnet *ifp;
+ int s;
+
+ KERNEL_LOCK(1, NULL);
+ s = splvm();
+ DOMAIN_FOREACH(dp) {
+ for (pr = dp->dom_protosw;
+ pr < dp->dom_protoswNPROTOSW; pr++)
+ if (pr->pr_drain)
+ (*pr->pr_drain)();
+ }
+ /* XXX we cannot use psref in H/W interrupt */
+ if (!cpu_intr_p()) {
+ int bound = curlwp_bind();
+ IFNET_READER_FOREACH(ifp) {
+ struct psref psref;
+
+ if_acquire(ifp, &psref);
+
+ if (ifp->if_drain)
+ (*ifp->if_drain)(ifp);
+
+ if_release(ifp, &psref);
+ }
+ curlwp_bindx(bound);
+ }
+ splx(s);
+ mbstat.m_drain++;
+ KERNEL_UNLOCK_ONE(NULL);
+}
+
/*
* sysctl helper routine for the kern.mbuf subtree.
* nmbclusters, mblowat and mcllowat need range
@@ -488,42 +525,6 @@
return c;
}
-void
-m_reclaim(void *arg, int flags)
-{
- struct domain *dp;
- const struct protosw *pr;
- struct ifnet *ifp;
- int s;
-
- KERNEL_LOCK(1, NULL);
- s = splvm();
- DOMAIN_FOREACH(dp) {
- for (pr = dp->dom_protosw;
- pr < dp->dom_protoswNPROTOSW; pr++)
- if (pr->pr_drain)
- (*pr->pr_drain)();
- }
- /* XXX we cannot use psref in H/W interrupt */
- if (!cpu_intr_p()) {
- int bound = curlwp_bind();
- IFNET_READER_FOREACH(ifp) {
- struct psref psref;
-
- if_acquire(ifp, &psref);
-
- if (ifp->if_drain)
- (*ifp->if_drain)(ifp);
-
- if_release(ifp, &psref);
- }
- curlwp_bindx(bound);
- }
- splx(s);
- mbstat.m_drain++;
- KERNEL_UNLOCK_ONE(NULL);
-}
-
struct mbuf *
m_get(int nowait, int type)
{
diff -r ce18d10135d6 -r b978030a3c74 sys/sys/mbuf.h
--- a/sys/sys/mbuf.h Fri Apr 27 07:20:33 2018 +0000
+++ b/sys/sys/mbuf.h Fri Apr 27 07:41:58 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbuf.h,v 1.192 2018/04/27 07:20:33 maxv Exp $ */
+/* $NetBSD: mbuf.h,v 1.193 2018/04/27 07:41:58 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -852,7 +852,6 @@
void m_verify_packet(struct mbuf *);
struct mbuf *m_free(struct mbuf *);
void m_freem(struct mbuf *);
-void m_reclaim(void *, int);
void mbinit(void);
void m_copy_pkthdr(struct mbuf *, struct mbuf *);
void m_move_pkthdr(struct mbuf *, struct mbuf *);
Home |
Main Index |
Thread Index |
Old Index