Convert a lot of uma_zalloc() calls to be NOWAIT instead of WAITOK. All

these may be called from contexts where we cannot sleep (callout handlers
for example).
This commit is contained in:
Hartmut Brandt 2003-07-23 14:28:57 +00:00
parent e717cfbc40
commit 06055f52f3
9 changed files with 48 additions and 30 deletions

View file

@ -168,8 +168,9 @@ atm_cm_connect(epp, token, ap, copp)
/*
* Get a connection block
* May be called from timeout - don't wait.
*/
cop = uma_zalloc(atm_connection_zone, M_WAITOK);
cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL)
return (ENOMEM);
@ -399,8 +400,9 @@ atm_cm_connect(epp, token, ap, copp)
/*
* Get a connection VCC block
* May be called from timeouts - don't wait.
*/
cvp = uma_zalloc(atm_connvc_zone, M_WAITOK);
cvp = uma_zalloc(atm_connvc_zone, M_NOWAIT);
if (cvp == NULL) {
err = ENOMEM;
goto donex;
@ -809,8 +811,9 @@ atm_cm_addllc(epp, token, llc, ecop, copp)
/*
* Get a connection block
* May be called from netisr - don't wait.
*/
cop = uma_zalloc(atm_connection_zone, M_WAITOK);
cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL)
return (ENOMEM);
@ -1260,8 +1263,9 @@ atm_cm_incoming(vcp, ap)
/*
* Get a connection VCC block
* May be called from netisr - don't wait.
*/
cvp = uma_zalloc(atm_connvc_zone, M_WAITOK);
cvp = uma_zalloc(atm_connvc_zone, M_NOWAIT);
if (cvp == NULL) {
err = ENOMEM;
goto fail;
@ -1578,8 +1582,9 @@ atm_cm_incall(cvp)
if (cop == NULL) {
/*
* Need a new connection block
* May be called from timeout - dont wait.
*/
cop = uma_zalloc(atm_connection_zone, M_WAITOK);
cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL) {
cvp->cvc_attr.cause = atm_cause_tmpl;
cvp->cvc_attr.cause.v.cause_value =

View file

@ -163,8 +163,9 @@ atm_dev_inst(ssp, cvcp)
/*
* Allocate a VCC control block
* This can happen from a callout so don't wait here.
*/
cvp = uma_zalloc(cup->cu_vcc_zone, M_WAITOK);
cvp = uma_zalloc(cup->cu_vcc_zone, M_NOWAIT);
if (cvp == NULL)
return (ENOMEM);

View file

@ -578,8 +578,9 @@ ipatm_createsvc(ifp, daf, dst, sivp)
/*
* Allocate IP VCC
* May be called from timeout - don't wait.
*/
ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
ivp = uma_zalloc(ipatm_vc_zone, M_NOWAIT);
if (ivp == NULL) {
err = ENOMEM;
goto done;
@ -930,8 +931,9 @@ ipatm_incoming(tok, cop, ap, tokp)
/*
* Allocate IP VCC
* May be called from timeout - don't wait.
*/
ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
ivp = uma_zalloc(ipatm_vc_zone, M_NOWAIT);
if (ivp == NULL) {
err = ENOMEM;
cause = T_ATM_CAUSE_UNSPECIFIED_RESOURCE_UNAVAILABLE;

View file

@ -703,9 +703,10 @@ uniarp_client_mode(uip, aap)
/*
* Now, get an arp entry for the server connection
* May be called from timeout - don't wait.
*/
uip->uip_arpstate = UIAS_CLIENT_POPEN;
uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
uap = uma_zalloc(uniarp_zone, M_NOWAIT | M_ZERO);
if (uap == NULL) {
UNIIP_ARP_TIMER(uip, 1 * ATM_HZ);
return;

View file

@ -117,9 +117,10 @@ uniarp_cache_svc(uip, ip, atm, atmsub, origin)
/*
* If there aren't any entries yet, create one
* May be called from netisr - don't wait.
*/
if ((ipuap == NULL) && (nouap == NULL)) {
ipuap = uma_zalloc(uniarp_zone, M_WAITOK);
ipuap = uma_zalloc(uniarp_zone, M_NOWAIT);
if (ipuap == NULL)
return (ENOMEM);
ipuap->ua_dstip.s_addr = ip->s_addr;

View file

@ -272,8 +272,9 @@ uniarp_svcout(ivp, dst)
/*
* We're a client with an open VCC to the server, get a new arp entry
* May be called from timeout - don't wait.
*/
uap = uma_zalloc(uniarp_zone, M_WAITOK);
uap = uma_zalloc(uniarp_zone, M_NOWAIT);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);
@ -433,8 +434,9 @@ uniarp_svcin(ivp, dst, dstsub)
/*
* No info in the cache - get a new arp entry
* May be called from timeout - don't wait.
*/
uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
uap = uma_zalloc(uniarp_zone, M_NOWAIT | M_ZERO);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);

View file

@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
#include <netatm/uni/unisig_decode.h>
#define ALLOC_IE(ie) do { \
(ie) = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); \
(ie) = uma_zalloc(unisig_ie_zone, M_NOWAIT | M_ZERO); \
if ((ie) == NULL) \
return (ENOMEM); \
} while (0)

View file

@ -267,8 +267,9 @@ unisig_open_vcc(usp, cvp)
/*
* Allocate control block for VCC
* May be called from timeout - don't wait.
*/
uvp = uma_zalloc(unisig_vc_zone, M_WAITOK | M_ZERO);
uvp = uma_zalloc(unisig_vc_zone, M_NOWAIT | M_ZERO);
if (uvp == NULL) {
return(ENOMEM);
}
@ -869,6 +870,7 @@ unisig_save_attrs(usp, msg, ap)
* 0 everything OK
* else error encountered
*
* May be called from timeout so make allocations non-waiting
*/
int
unisig_set_attrs(usp, msg, ap)
@ -890,7 +892,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->aal.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_aalp) {
msg->msg_ie_aalp = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_aalp == NULL) {
err = ENOMEM;
goto done;
@ -948,7 +950,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->traffic.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_clrt) {
msg->msg_ie_clrt = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_clrt == NULL) {
err = ENOMEM;
goto done;
@ -1005,7 +1007,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->bearer.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bbcp) {
msg->msg_ie_bbcp = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_bbcp == NULL) {
err = ENOMEM;
goto done;
@ -1033,7 +1035,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->bhli.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bhli) {
msg->msg_ie_bhli = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_bhli == NULL) {
err = ENOMEM;
goto done;
@ -1073,7 +1075,7 @@ unisig_set_attrs(usp, msg, ap)
ap->blli.tag_l3 == T_ATM_PRESENT) {
if (!msg->msg_ie_blli) {
msg->msg_ie_blli = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_blli == NULL) {
err = ENOMEM;
goto done;
@ -1158,7 +1160,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->called.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cdad) {
msg->msg_ie_cdad = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_cdad == NULL) {
err = ENOMEM;
goto done;
@ -1174,7 +1176,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->called.subaddr.address_format != T_ATM_ABSENT) {
if (!msg->msg_ie_cdsa) {
msg->msg_ie_cdsa = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_cdsa == NULL) {
err = ENOMEM;
goto done;
@ -1196,7 +1198,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->calling.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cgad) {
msg->msg_ie_cgad = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_cgad == NULL) {
err = ENOMEM;
goto done;
@ -1213,7 +1215,7 @@ unisig_set_attrs(usp, msg, ap)
T_ATM_ABSENT) {
if (!msg->msg_ie_cgsa) {
msg->msg_ie_cgsa = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_cgsa == NULL) {
err = ENOMEM;
goto done;
@ -1234,7 +1236,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->qos.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_qosp) {
msg->msg_ie_qosp = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_qosp == NULL) {
err = ENOMEM;
goto done;
@ -1266,7 +1268,7 @@ unisig_set_attrs(usp, msg, ap)
ap->transit.v.length != 0) {
if (!msg->msg_ie_trnt) {
msg->msg_ie_trnt = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_trnt == NULL) {
err = ENOMEM;
goto done;
@ -1291,7 +1293,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->cause.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_caus) {
msg->msg_ie_caus = uma_zalloc(unisig_ie_zone,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (msg->msg_ie_caus == NULL) {
err = ENOMEM;
goto done;

View file

@ -659,9 +659,10 @@ unisig_vc_act06(usp, uvp, msg)
} else {
/*
* No--VCI must have been specified earlier
* May be called from netisr - don't wait.
*/
if (!uvp->uv_vci) {
iep = uma_zalloc(unisig_ie_zone, M_WAITOK);
iep = uma_zalloc(unisig_ie_zone, M_NOWAIT);
if (iep == NULL)
return(ENOMEM);
iep->ie_ident = UNI_IE_CNID;
@ -734,8 +735,9 @@ unisig_vc_act06(usp, uvp, msg)
/*
* Get memory for a CONNECT ACK message
* May be called from netisr.
*/
cack_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
cack_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (cack_msg == NULL)
return(ENOMEM);
@ -1051,7 +1053,8 @@ unisig_vc_act09(usp, uvp, msg)
int rc;
struct unisig_msg *conn_msg;
conn_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
/* may be called from timeout - don't wait */
conn_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (conn_msg == NULL)
return(ENOMEM);
@ -1603,8 +1606,9 @@ unisig_vc_act20(usp, uvp, msg)
/*
* Get memory for a STATUS ENQUIRY message
* May be called from netisr - don't wait.
*/
stat_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
stat_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (stat_msg == NULL)
return(ENOMEM);