Skip to content

Commit eb04f2f

Browse files
committed
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (78 commits) Revert "rcu: Decrease memory-barrier usage based on semi-formal proof" net,rcu: convert call_rcu(prl_entry_destroy_rcu) to kfree batman,rcu: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu batman,rcu: convert call_rcu(neigh_node_free_rcu) to kfree() batman,rcu: convert call_rcu(gw_node_free_rcu) to kfree_rcu net,rcu: convert call_rcu(kfree_tid_tx) to kfree_rcu() net,rcu: convert call_rcu(xt_osf_finger_free_rcu) to kfree_rcu() net/mac80211,rcu: convert call_rcu(work_free_rcu) to kfree_rcu() net,rcu: convert call_rcu(wq_free_rcu) to kfree_rcu() net,rcu: convert call_rcu(phonet_device_rcu_free) to kfree_rcu() perf,rcu: convert call_rcu(swevent_hlist_release_rcu) to kfree_rcu() perf,rcu: convert call_rcu(free_ctx) to kfree_rcu() net,rcu: convert call_rcu(__nf_ct_ext_free_rcu) to kfree_rcu() net,rcu: convert call_rcu(net_generic_release) to kfree_rcu() net,rcu: convert call_rcu(netlbl_unlhsh_free_addr6) to kfree_rcu() net,rcu: convert call_rcu(netlbl_unlhsh_free_addr4) to kfree_rcu() security,rcu: convert call_rcu(sel_netif_free) to kfree_rcu() net,rcu: convert call_rcu(xps_dev_maps_release) to kfree_rcu() net,rcu: convert call_rcu(xps_map_release) to kfree_rcu() net,rcu: convert call_rcu(rps_map_release) to kfree_rcu() ...
2 parents 5765040 + 80d0208 commit eb04f2f

56 files changed

Lines changed: 1724 additions & 833 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/RCU/00-INDEX‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rcu.txt
2121
RTFP.txt
2222
- List of RCU papers (bibliography) going back to 1980.
2323
stallwarn.txt
24-
- RCU CPU stall warnings (CONFIG_RCU_CPU_STALL_DETECTOR)
24+
- RCU CPU stall warnings (module parameter rcu_cpu_stall_suppress)
2525
torture.txt
2626
- RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST)
2727
trace.txt

‎Documentation/RCU/stallwarn.txt‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
Using RCU's CPU Stall Detector
22

3-
The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables
4-
RCU's CPU stall detector, which detects conditions that unduly delay
5-
RCU grace periods. The stall detector's idea of what constitutes
6-
"unduly delayed" is controlled by a set of C preprocessor macros:
3+
The rcu_cpu_stall_suppress module parameter enables RCU's CPU stall
4+
detector, which detects conditions that unduly delay RCU grace periods.
5+
This module parameter enables CPU stall detection by default, but
6+
may be overridden via boot-time parameter or at runtime via sysfs.
7+
The stall detector's idea of what constitutes "unduly delayed" is
8+
controlled by a set of kernel configuration variables and cpp macros:
79

8-
RCU_SECONDS_TILL_STALL_CHECK
10+
CONFIG_RCU_CPU_STALL_TIMEOUT
911

10-
This macro defines the period of time that RCU will wait from
11-
the beginning of a grace period until it issues an RCU CPU
12-
stall warning. This time period is normally ten seconds.
12+
This kernel configuration parameter defines the period of time
13+
that RCU will wait from the beginning of a grace period until it
14+
issues an RCU CPU stall warning. This time period is normally
15+
ten seconds.
1316

1417
RCU_SECONDS_TILL_STALL_RECHECK
1518

1619
This macro defines the period of time that RCU will wait after
1720
issuing a stall warning until it issues another stall warning
18-
for the same stall. This time period is normally set to thirty
19-
seconds.
21+
for the same stall. This time period is normally set to three
22+
times the check interval plus thirty seconds.
2023

2124
RCU_STALL_RAT_DELAY
2225

‎Documentation/RCU/trace.txt‎

Lines changed: 231 additions & 47 deletions
Large diffs are not rendered by default.

‎Documentation/filesystems/proc.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ Provides counts of softirq handlers serviced since boot time, for each cpu.
836836
TASKLET: 0 0 0 290
837837
SCHED: 27035 26983 26971 26746
838838
HRTIMER: 0 0 0 0
839-
RCU: 1678 1769 2178 2250
840839

841840

842841
1.3 IDE devices in /proc/ide

‎drivers/net/ixgbe/ixgbe_main.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5100,11 +5100,6 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
51005100
return err;
51015101
}
51025102

5103-
static void ring_free_rcu(struct rcu_head *head)
5104-
{
5105-
kfree(container_of(head, struct ixgbe_ring, rcu));
5106-
}
5107-
51085103
/**
51095104
* ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings
51105105
* @adapter: board private structure to clear interrupt scheme on
@@ -5126,7 +5121,7 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
51265121
/* ixgbe_get_stats64() might access this ring, we must wait
51275122
* a grace period before freeing it.
51285123
*/
5129-
call_rcu(&ring->rcu, ring_free_rcu);
5124+
kfree_rcu(ring, rcu);
51305125
adapter->rx_ring[i] = NULL;
51315126
}
51325127

‎drivers/net/macvlan.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,21 +603,13 @@ static int macvlan_port_create(struct net_device *dev)
603603
return err;
604604
}
605605

606-
static void macvlan_port_rcu_free(struct rcu_head *head)
607-
{
608-
struct macvlan_port *port;
609-
610-
port = container_of(head, struct macvlan_port, rcu);
611-
kfree(port);
612-
}
613-
614606
static void macvlan_port_destroy(struct net_device *dev)
615607
{
616608
struct macvlan_port *port = macvlan_port_get(dev);
617609

618610
dev->priv_flags &= ~IFF_MACVLAN_PORT;
619611
netdev_rx_handler_unregister(dev);
620-
call_rcu(&port->rcu, macvlan_port_rcu_free);
612+
kfree_rcu(port, rcu);
621613
}
622614

623615
static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])

‎include/linux/interrupt.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ enum
414414
TASKLET_SOFTIRQ,
415415
SCHED_SOFTIRQ,
416416
HRTIMER_SOFTIRQ,
417-
RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
418417

419418
NR_SOFTIRQS
420419
};

‎include/linux/rcupdate.h‎

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@
4747
extern int rcutorture_runnable; /* for sysctl */
4848
#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
4949

50+
#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
51+
extern void rcutorture_record_test_transition(void);
52+
extern void rcutorture_record_progress(unsigned long vernum);
53+
#else
54+
static inline void rcutorture_record_test_transition(void)
55+
{
56+
}
57+
static inline void rcutorture_record_progress(unsigned long vernum)
58+
{
59+
}
60+
#endif
61+
5062
#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b))
5163
#define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b))
5264
#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
@@ -68,7 +80,6 @@ extern void call_rcu_sched(struct rcu_head *head,
6880
extern void synchronize_sched(void);
6981
extern void rcu_barrier_bh(void);
7082
extern void rcu_barrier_sched(void);
71-
extern int sched_expedited_torture_stats(char *page);
7283

7384
static inline void __rcu_read_lock_bh(void)
7485
{
@@ -774,6 +785,7 @@ extern struct debug_obj_descr rcuhead_debug_descr;
774785

775786
static inline void debug_rcu_head_queue(struct rcu_head *head)
776787
{
788+
WARN_ON_ONCE((unsigned long)head & 0x3);
777789
debug_object_activate(head, &rcuhead_debug_descr);
778790
debug_object_active_state(head, &rcuhead_debug_descr,
779791
STATE_RCU_HEAD_READY,
@@ -797,4 +809,60 @@ static inline void debug_rcu_head_unqueue(struct rcu_head *head)
797809
}
798810
#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
799811

812+
static __always_inline bool __is_kfree_rcu_offset(unsigned long offset)
813+
{
814+
return offset < 4096;
815+
}
816+
817+
static __always_inline
818+
void __kfree_rcu(struct rcu_head *head, unsigned long offset)
819+
{
820+
typedef void (*rcu_callback)(struct rcu_head *);
821+
822+
BUILD_BUG_ON(!__builtin_constant_p(offset));
823+
824+
/* See the kfree_rcu() header comment. */
825+
BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));
826+
827+
call_rcu(head, (rcu_callback)offset);
828+
}
829+
830+
extern void kfree(const void *);
831+
832+
static inline void __rcu_reclaim(struct rcu_head *head)
833+
{
834+
unsigned long offset = (unsigned long)head->func;
835+
836+
if (__is_kfree_rcu_offset(offset))
837+
kfree((void *)head - offset);
838+
else
839+
head->func(head);
840+
}
841+
842+
/**
843+
* kfree_rcu() - kfree an object after a grace period.
844+
* @ptr: pointer to kfree
845+
* @rcu_head: the name of the struct rcu_head within the type of @ptr.
846+
*
847+
* Many rcu callbacks functions just call kfree() on the base structure.
848+
* These functions are trivial, but their size adds up, and furthermore
849+
* when they are used in a kernel module, that module must invoke the
850+
* high-latency rcu_barrier() function at module-unload time.
851+
*
852+
* The kfree_rcu() function handles this issue. Rather than encoding a
853+
* function address in the embedded rcu_head structure, kfree_rcu() instead
854+
* encodes the offset of the rcu_head structure within the base structure.
855+
* Because the functions are not allowed in the low-order 4096 bytes of
856+
* kernel virtual memory, offsets up to 4095 bytes can be accommodated.
857+
* If the offset is larger than 4095 bytes, a compile-time error will
858+
* be generated in __kfree_rcu(). If this error is triggered, you can
859+
* either fall back to use of call_rcu() or rearrange the structure to
860+
* position the rcu_head structure into the first 4096 bytes.
861+
*
862+
* Note that the allowable offset might decrease in the future, for example,
863+
* to allow something like kmem_cache_free_rcu().
864+
*/
865+
#define kfree_rcu(ptr, rcu_head) \
866+
__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
867+
800868
#endif /* __LINUX_RCUPDATE_H */

‎include/linux/rcutiny.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ static inline void rcu_note_context_switch(int cpu)
9999
rcu_preempt_note_context_switch();
100100
}
101101

102+
/*
103+
* Take advantage of the fact that there is only one CPU, which
104+
* allows us to ignore virtualization-based context switches.
105+
*/
106+
static inline void rcu_virt_note_context_switch(int cpu)
107+
{
108+
}
109+
102110
/*
103111
* Return the number of grace periods.
104112
*/

‎include/linux/rcutree.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ extern void rcu_note_context_switch(int cpu);
3535
extern int rcu_needs_cpu(int cpu);
3636
extern void rcu_cpu_stall_reset(void);
3737

38+
/*
39+
* Note a virtualization-based context switch. This is simply a
40+
* wrapper around rcu_note_context_switch(), which allows TINY_RCU
41+
* to save a few bytes.
42+
*/
43+
static inline void rcu_virt_note_context_switch(int cpu)
44+
{
45+
rcu_note_context_switch(cpu);
46+
}
47+
3848
#ifdef CONFIG_TREE_PREEMPT_RCU
3949

4050
extern void exit_rcu(void);
@@ -58,9 +68,12 @@ static inline void synchronize_rcu_bh_expedited(void)
5868

5969
extern void rcu_barrier(void);
6070

71+
extern unsigned long rcutorture_testseq;
72+
extern unsigned long rcutorture_vernum;
6173
extern long rcu_batches_completed(void);
6274
extern long rcu_batches_completed_bh(void);
6375
extern long rcu_batches_completed_sched(void);
76+
6477
extern void rcu_force_quiescent_state(void);
6578
extern void rcu_bh_force_quiescent_state(void);
6679
extern void rcu_sched_force_quiescent_state(void);

0 commit comments

Comments
 (0)