Arvind M | 8e87d85 | 2018-01-29 00:04:29 -0800 | [diff] [blame] | 1 | From 062836aa29e05a94bc23534d903401ea687a2ff9 Mon Sep 17 00:00:00 2001 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 2 | From: Thomas Gleixner <tglx@linutronix.de> |
| 3 | Date: Wed, 7 Mar 2012 21:10:04 +0100 |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 4 | Subject: [PATCH 169/366] net: Use cpu_chill() instead of cpu_relax() |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 5 | |
| 6 | Retry loops on RT might loop forever when the modifying side was |
| 7 | preempted. Use cpu_chill() instead of cpu_relax() to let the system |
| 8 | make progress. |
| 9 | |
| 10 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 11 | --- |
| 12 | net/packet/af_packet.c | 5 +++-- |
| 13 | net/rds/ib_rdma.c | 3 ++- |
| 14 | 2 files changed, 5 insertions(+), 3 deletions(-) |
| 15 | |
| 16 | diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 17 | index c148581..759d6ed 100644 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 18 | --- a/net/packet/af_packet.c |
| 19 | +++ b/net/packet/af_packet.c |
| 20 | @@ -63,6 +63,7 @@ |
| 21 | #include <linux/if_packet.h> |
| 22 | #include <linux/wireless.h> |
| 23 | #include <linux/kernel.h> |
| 24 | +#include <linux/delay.h> |
| 25 | #include <linux/kmod.h> |
| 26 | #include <linux/slab.h> |
| 27 | #include <linux/vmalloc.h> |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 28 | @@ -694,7 +695,7 @@ static void prb_retire_rx_blk_timer_expired(unsigned long data) |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 29 | if (BLOCK_NUM_PKTS(pbd)) { |
| 30 | while (atomic_read(&pkc->blk_fill_in_prog)) { |
| 31 | /* Waiting for skb_copy_bits to finish... */ |
| 32 | - cpu_relax(); |
| 33 | + cpu_chill(); |
| 34 | } |
| 35 | } |
| 36 | |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 37 | @@ -956,7 +957,7 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc, |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 38 | if (!(status & TP_STATUS_BLK_TMO)) { |
| 39 | while (atomic_read(&pkc->blk_fill_in_prog)) { |
| 40 | /* Waiting for skb_copy_bits to finish... */ |
| 41 | - cpu_relax(); |
| 42 | + cpu_chill(); |
| 43 | } |
| 44 | } |
| 45 | prb_close_block(pkc, pbd, po, status); |
| 46 | diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 47 | index a234074..19123a9 100644 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 48 | --- a/net/rds/ib_rdma.c |
| 49 | +++ b/net/rds/ib_rdma.c |
| 50 | @@ -34,6 +34,7 @@ |
| 51 | #include <linux/slab.h> |
| 52 | #include <linux/rculist.h> |
| 53 | #include <linux/llist.h> |
| 54 | +#include <linux/delay.h> |
| 55 | |
| 56 | #include "rds.h" |
| 57 | #include "ib.h" |
| 58 | @@ -313,7 +314,7 @@ static inline void wait_clean_list_grace(void) |
| 59 | for_each_online_cpu(cpu) { |
| 60 | flag = &per_cpu(clean_list_grace, cpu); |
| 61 | while (test_bit(CLEAN_LIST_BUSY_BIT, flag)) |
| 62 | - cpu_relax(); |
| 63 | + cpu_chill(); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | -- |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 68 | 1.9.1 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 69 | |