diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2009-09-17 13:43:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-09-23 11:35:53 -0400 |
commit | f82a924cc88a5541df1d4b9d38a0968cd077a051 (patch) | |
tree | 86bafe3162f0c334deb4a41012101e1b345622f6 /drivers/net | |
parent | bba98871c6c5f1f086086ccf13836a02e0f27e77 (diff) |
iwlwifi: reduce noise when skb allocation fails
Replenishment of receive buffers is done in the tasklet handling
received frames as well as in a workqueue. When we are in the tasklet
we cannot sleep and thus attempt atomic skb allocations. It is generally
not a big problem if this fails since iwl_rx_allocate is always followed
by a call to iwl_rx_queue_restock which will queue the work to replenish
the buffers at a time when sleeping is allowed.
We thus add the __GFP_NOWARN to the skb allocation in iwl_rx_allocate to
reduce the noise if such an allocation fails while we still have enough
buffers. We do maintain the warning and the error message when we are low
on buffers to communicate to the user that there is a potential problem with
memory availability on system
This addresses issue reported upstream in thread "iwlagn: order 2 page
allocation failures" in
http://thread.gmane.org/gmane.linux.kernel.wireless.general/39187
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index b90adcb73b06..8e1bb53c0aa3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -250,12 +250,20 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority) | |||
250 | } | 250 | } |
251 | spin_unlock_irqrestore(&rxq->lock, flags); | 251 | spin_unlock_irqrestore(&rxq->lock, flags); |
252 | 252 | ||
253 | if (rxq->free_count > RX_LOW_WATERMARK) | ||
254 | priority |= __GFP_NOWARN; | ||
253 | /* Alloc a new receive buffer */ | 255 | /* Alloc a new receive buffer */ |
254 | skb = alloc_skb(priv->hw_params.rx_buf_size + 256, | 256 | skb = alloc_skb(priv->hw_params.rx_buf_size + 256, |
255 | priority); | 257 | priority); |
256 | 258 | ||
257 | if (!skb) { | 259 | if (!skb) { |
258 | IWL_CRIT(priv, "Can not allocate SKB buffers\n"); | 260 | if (net_ratelimit()) |
261 | IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); | ||
262 | if ((rxq->free_count <= RX_LOW_WATERMARK) && | ||
263 | net_ratelimit()) | ||
264 | IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", | ||
265 | priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", | ||
266 | rxq->free_count); | ||
259 | /* We don't reschedule replenish work here -- we will | 267 | /* We don't reschedule replenish work here -- we will |
260 | * call the restock method and if it still needs | 268 | * call the restock method and if it still needs |
261 | * more buffers it will schedule replenish */ | 269 | * more buffers it will schedule replenish */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 090966837f3c..4f2d43937283 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1146,11 +1146,18 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) | |||
1146 | } | 1146 | } |
1147 | spin_unlock_irqrestore(&rxq->lock, flags); | 1147 | spin_unlock_irqrestore(&rxq->lock, flags); |
1148 | 1148 | ||
1149 | if (rxq->free_count > RX_LOW_WATERMARK) | ||
1150 | priority |= __GFP_NOWARN; | ||
1149 | /* Alloc a new receive buffer */ | 1151 | /* Alloc a new receive buffer */ |
1150 | skb = alloc_skb(priv->hw_params.rx_buf_size, priority); | 1152 | skb = alloc_skb(priv->hw_params.rx_buf_size, priority); |
1151 | if (!skb) { | 1153 | if (!skb) { |
1152 | if (net_ratelimit()) | 1154 | if (net_ratelimit()) |
1153 | IWL_CRIT(priv, ": Can not allocate SKB buffers\n"); | 1155 | IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); |
1156 | if ((rxq->free_count <= RX_LOW_WATERMARK) && | ||
1157 | net_ratelimit()) | ||
1158 | IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", | ||
1159 | priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", | ||
1160 | rxq->free_count); | ||
1154 | /* We don't reschedule replenish work here -- we will | 1161 | /* We don't reschedule replenish work here -- we will |
1155 | * call the restock method and if it still needs | 1162 | * call the restock method and if it still needs |
1156 | * more buffers it will schedule replenish */ | 1163 | * more buffers it will schedule replenish */ |