FreeBSD Bugzilla – Attachment 6077 Details for
Bug 14042
mbuf shortage and allocation with M_WAIT results in a panic
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.67 KB, created by
bmilekic@dsuper.net
on 1999-09-30 04:10:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
bmilekic@dsuper.net
Created:
1999-09-30 04:10:00 UTC
Size:
3.67 KB
patch
obsolete
>--- mbuf.h.orig Sun Sep 26 14:17:20 1999 >+++ mbuf.h Tue Sep 28 23:39:22 1999 >@@ -153,6 +153,17 @@ > #define M_DONTWAIT 1 > #define M_WAIT 0 > >+/* >+ * Flags to pass to the *_wait functions (when we have to wait for an >+ * mbuf to be freed). >+ * XXX this could theoretically also be implemented as a char (which would >+ * be SLIGHTLY less costly) that would be ORed with a specific 'pattern' >+ * that could represent each one of the options -- but it's kept this way >+ * for now for simplicity's sake. >+ */ >+#define MGET_C 1 >+#define MGETHDR_C 2 >+ > /* Freelists: > * > * Normal mbuf clusters are normally treated as character arrays >@@ -203,7 +214,8 @@ > splx(_ms); \ > } else { \ > splx(_ms); \ >- (m) = m_retry((how), (type)); \ >+ if (((m)=m_retry((how), (type)))==NULL && (how)==M_WAIT) \ >+ (m) = m_mballoc_wait(MGET_C,(type)); \ > } \ > } > >@@ -223,7 +235,8 @@ > splx(_ms); \ > } else { \ > splx(_ms); \ >- (m) = m_retryhdr((how), (type)); \ >+ if (((m)=m_retryhdr((how),(type)))==NULL && (how)==M_WAIT) \ >+ (m) = m_mballoc_wait(MGETHDR_C,(type)); \ > } \ > } > >@@ -235,16 +248,20 @@ > * MCLFREE releases a reference to a cluster allocated by MCLALLOC, > * freeing the cluster if the reference count has reached 0. > */ >-#define MCLALLOC(p, how) \ >- MBUFLOCK( \ >- if (mclfree == 0) \ >+#define MCLALLOC(p, how) { \ >+ int _ms = splimp(); \ >+ if (mclfree == 0) \ > (void)m_clalloc(1, (how)); \ >- if (((p) = (caddr_t)mclfree) != 0) { \ >+ if (((p) = (caddr_t)mclfree) != 0) { \ > ++mclrefcnt[mtocl(p)]; \ > mbstat.m_clfree--; \ > mclfree = ((union mcluster *)(p))->mcl_next; \ >- } \ >- ) >+ splx(_ms); \ >+ } else if ((how) == M_WAIT) { \ >+ splx(_ms); \ >+ (p) = m_clalloc_wait(); \ >+ } \ >+} > > #define MCLGET(m, how) \ > { MCLALLOC((m)->m_ext.ext_buf, (how)); \ >@@ -263,6 +280,7 @@ > ((union mcluster *)(p))->mcl_next = mclfree; \ > mclfree = (union mcluster *)(p); \ > mbstat.m_clfree++; \ >+ (void)m_clalloc_wakeup(); \ > } \ > ) > >@@ -284,6 +302,7 @@ > ((union mcluster *)(p))->mcl_next = mclfree; \ > mclfree = (union mcluster *)(p); \ > mbstat.m_clfree++; \ >+ (void)m_clalloc_wakeup(); \ > } \ > } \ > } \ >@@ -292,6 +311,7 @@ > mbstat.m_mtypes[MT_FREE]++; \ > (m)->m_next = mmbfree; \ > mmbfree = (m); \ >+ (void)m_mballoc_wakeup(); \ > ) > > /* >@@ -408,16 +428,20 @@ > struct mbuf *m_gethdr __P((int, int)); > struct mbuf *m_prepend __P((struct mbuf *,int,int)); > struct mbuf *m_pullup __P((struct mbuf *, int)); >+struct mbuf *m_mballoc_wait __P((int,u_short)); > struct mbuf *m_retry __P((int, int)); > struct mbuf *m_retryhdr __P((int, int)); > struct mbuf *m_split __P((struct mbuf *,int,int)); > void m_adj __P((struct mbuf *, int)); > void m_cat __P((struct mbuf *,struct mbuf *)); >+void m_mballoc_wakeup __P((void)); >+void m_clalloc_wakeup __P((void)); > int m_mballoc __P((int, int)); > int m_clalloc __P((int, int)); > void m_copyback __P((struct mbuf *, int, int, caddr_t)); > void m_copydata __P((struct mbuf *,int,int,caddr_t)); > void m_freem __P((struct mbuf *)); >+caddr_t m_clalloc_wait __P((void)); > #endif /* KERNEL */ > > #endif /* !_SYS_MBUF_H_ */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14042
: 6077