Skip to contentSkip to conversation

libcxgbi: do not print a message when memory allocation fails

PATCH In review Thadeu Lima de Souza Cascardo 3 participants 4 messages Dec 14, 2011 – Dec 26, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcxgbi: do not print a message when memory allocation fails

In alloc_pdu, libcxgbi tries to allocate a skb with GFP_ATOMIC, which may potentially fail. When it happens, the current code prints a warning message.

When the system is under IO stress, this failure may happen lots of times and it usually scares users.

Instead of printing the warning message, the code now increases the tx_dropped statistics for the ethernet interface wich is doing the iscsi task.

---
 drivers/scsi/cxgbi/libcxgbi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/cxgbi/libcxgbi.c +3 -2
index c10f74a..3422bc2 100644
@@ -1862,8 +1862,9 @@ int cxgbi_conn_alloc_pdu(struct iscsi_task *task, u8 opcode)
 
 	tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom, GFP_ATOMIC);
 	if (!tdata->skb) {
-		pr_warn("alloc skb %u+%u, opcode 0x%x failed.\n",
-			cdev->skb_tx_rsvd, headroom, opcode);
+		struct cxgbi_sock *csk = cconn->cep->csk;
+		struct net_device *ndev = cdev->ports[csk->port_id];
+		ndev->stats.tx_dropped++;
 		return -ENOMEM;
 	}
 
Signature · 1 line
1.7.4.4
#1 lore raw

The patch looks fine to me.

Thanks,
Karen

-----Original Message-----
From: Thadeu Lima de Souza Cascardo [mailto:[email protected]]

Sent: Wednesday, December 14, 2011 7:46 AM
To: [email protected]
Cc: [email protected]; Karen Xie; [email protected]; [email protected]; [email protected]; [email protected]; Thadeu Lima de Souza Cascardo
Subject: [PATCH] libcxgbi: do not print a message when memory allocation fails

In alloc_pdu, libcxgbi tries to allocate a skb with GFP_ATOMIC, which may potentially fail. When it happens, the current code prints a warning message.

When the system is under IO stress, this failure may happen lots of times and it usually scares users.

Instead of printing the warning message, the code now increases the tx_dropped statistics for the ethernet interface wich is doing the iscsi task.

Signed-off-by: Thadeu Lima de Souza Cascardo
<[email protected]>

---
 drivers/scsi/cxgbi/libcxgbi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/scsi/cxgbi/libcxgbi.c
index c10f74a..3422bc2 100644

drivers/scsi/cxgbi/libcxgbi.c +0 -0
@@ -1862,8 +1862,9 @@ int cxgbi_conn_alloc_pdu(struct iscsi_task *task,

u8 opcode)

tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom,
GFP_ATOMIC);
if (!tdata->skb) {
- pr_warn("alloc skb %u+%u, opcode 0x%x failed.\n",
- cdev->skb_tx_rsvd, headroom, opcode);
+ struct cxgbi_sock *csk = cconn->cep->csk;
+ struct net_device *ndev = cdev->ports[csk->port_id];
+ ndev->stats.tx_dropped++;
return -ENOMEM;
}

Signature · 1 line
1.7.4.4
#2 lore raw
Quoted 5 lines · Karen Xie

The patch looks fine to me.

Thanks,
Karen

Hi, Karen.

Thanks for your quick response.

Care to send a proper Acked-by? It seems this patch has not yet catch up in James' tree.

Regards.
Cascardo.

Quoted 50 lines

-----Original Message-----
From: Thadeu Lima de Souza Cascardo [mailto:[email protected]]

Sent: Wednesday, December 14, 2011 7:46 AM
To: [email protected]
Cc: [email protected]; Karen Xie; [email protected]; [email protected]; [email protected]; [email protected]; Thadeu Lima de Souza Cascardo
Subject: [PATCH] libcxgbi: do not print a message when memory allocation fails

In alloc_pdu, libcxgbi tries to allocate a skb with GFP_ATOMIC, which may potentially fail. When it happens, the current code prints a warning message.

When the system is under IO stress, this failure may happen lots of times and it usually scares users.

Instead of printing the warning message, the code now increases the tx_dropped statistics for the ethernet interface wich is doing the iscsi task.

Signed-off-by: Thadeu Lima de Souza Cascardo
<[email protected]>

---
 drivers/scsi/cxgbi/libcxgbi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/cxgbi/libcxgbi.c +3 -2
index c10f74a..3422bc2 100644
@@ -1862,8 +1862,9 @@ int cxgbi_conn_alloc_pdu(struct iscsi_task *task,
 u8 opcode)
 
 	tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom,
 GFP_ATOMIC);
 	if (!tdata->skb) {
-		pr_warn("alloc skb %u+%u, opcode 0x%x failed.\n",
-			cdev->skb_tx_rsvd, headroom, opcode);
+		struct cxgbi_sock *csk = cconn->cep->csk;
+		struct net_device *ndev = cdev->ports[csk->port_id];
+		ndev->stats.tx_dropped++;
 		return -ENOMEM;

}

Signature · 1 line
1.7.4.4
Reviewed-by on v1 1/1
#3 lore raw
In reply to Thadeu Lima de Souza Cascardo
Quoted 22 lines · Thadeu Lima de Souza Cascardo

In alloc_pdu, libcxgbi tries to allocate a skb with GFP_ATOMIC, which may potentially fail. When it happens, the current code prints a warning message.

When the system is under IO stress, this failure may happen lots of times and it usually scares users.

Instead of printing the warning message, the code now increases the tx_dropped statistics for the ethernet interface wich is doing the iscsi task.

---
 drivers/scsi/cxgbi/libcxgbi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/cxgbi/libcxgbi.c +0 -0
index c10f74a..3422bc2 100644
@@ -1862,8 +1862,9 @@ int cxgbi_conn_alloc_pdu(struct iscsi_task *task, u8 opcode)
 

drivers/scsi/cxgbi/libcxgbi.c int cxgbi_conn_alloc_pdu(struct iscsi_task *task, u8 opcode) · line 1870

Quoted 10 lines
drivers/scsi/cxgbi/libcxgbi.c +3 -2
 	tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom, GFP_ATOMIC);
 	if (!tdata->skb) {
-		pr_warn("alloc skb %u+%u, opcode 0x%x failed.\n",
-			cdev->skb_tx_rsvd, headroom, opcode);
+		struct cxgbi_sock *csk = cconn->cep->csk;
+		struct net_device *ndev = cdev->ports[csk->port_id];
+		ndev->stats.tx_dropped++;
 		return -ENOMEM;
 	}
 

Looks ok to me.