lkml.org 
[lkml]   [2022]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH v2 1/8] rcu: Introduce call_rcu_lazy() API implementation
    On Wed, Jun 22, 2022 at 10:50:55PM +0000, Joel Fernandes (Google) wrote:
    [..]
    > diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
    > index 2ccf5845957d..fec4fad6654b 100644
    > --- a/kernel/rcu/tree.h
    > +++ b/kernel/rcu/tree.h
    > @@ -267,8 +267,9 @@ struct rcu_data {
    > /* Values for nocb_defer_wakeup field in struct rcu_data. */
    > #define RCU_NOCB_WAKE_NOT 0
    > #define RCU_NOCB_WAKE_BYPASS 1
    > -#define RCU_NOCB_WAKE 2
    > -#define RCU_NOCB_WAKE_FORCE 3
    > +#define RCU_NOCB_WAKE_LAZY 2
    > +#define RCU_NOCB_WAKE 3
    > +#define RCU_NOCB_WAKE_FORCE 4
    >
    > #define RCU_JIFFIES_TILL_FORCE_QS (1 + (HZ > 250) + (HZ > 500))
    > /* For jiffies_till_first_fqs and */
    > @@ -436,9 +437,10 @@ static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp);
    > static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq);
    > static void rcu_init_one_nocb(struct rcu_node *rnp);
    > static bool rcu_nocb_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
    > - unsigned long j);
    > + unsigned long j, bool lazy);
    > static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
    > - bool *was_alldone, unsigned long flags);
    > + bool *was_alldone, unsigned long flags,
    > + bool lazy);
    > static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_empty,
    > unsigned long flags);
    > static int rcu_nocb_need_deferred_wakeup(struct rcu_data *rdp, int level);
    > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
    > index e369efe94fda..b9244f22e102 100644
    > --- a/kernel/rcu/tree_nocb.h
    > +++ b/kernel/rcu/tree_nocb.h
    > @@ -256,6 +256,8 @@ static bool wake_nocb_gp(struct rcu_data *rdp, bool force)
    > return __wake_nocb_gp(rdp_gp, rdp, force, flags);
    > }
    >
    > +#define LAZY_FLUSH_JIFFIES (10 * HZ)
    > +
    > /*
    > * Arrange to wake the GP kthread for this NOCB group at some future
    > * time when it is safe to do so.
    > @@ -272,7 +274,10 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
    > * Bypass wakeup overrides previous deferments. In case
    > * of callback storm, no need to wake up too early.
    > */
    > - if (waketype == RCU_NOCB_WAKE_BYPASS) {
    > + if (waketype == RCU_NOCB_WAKE_LAZY) {
    > + mod_timer(&rdp_gp->nocb_timer, jiffies + LAZY_FLUSH_JIFFIES);
    > + WRITE_ONCE(rdp_gp->nocb_defer_wakeup, waketype);
    > + } else if (waketype == RCU_NOCB_WAKE_BYPASS) {
    > mod_timer(&rdp_gp->nocb_timer, jiffies + 2);
    > WRITE_ONCE(rdp_gp->nocb_defer_wakeup, waketype);
    > } else {
    > @@ -296,7 +301,7 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
    > * Note that this function always returns true if rhp is NULL.
    > */
    > static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
    > - unsigned long j)
    > + unsigned long j, bool lazy)
    > {
    > struct rcu_cblist rcl;
    >
    > @@ -310,7 +315,13 @@ static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
    > /* Note: ->cblist.len already accounts for ->nocb_bypass contents. */
    > if (rhp)
    > rcu_segcblist_inc_len(&rdp->cblist); /* Must precede enqueue. */
    > - rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp);
    > +
    > + trace_printk("call_rcu_lazy callbacks = %ld\n", READ_ONCE(rdp->nocb_bypass.lazy_len));

    Before anyone yells at me, that trace_printk() has been politely asked to take
    a walk :-). It got mad at me, but on the next iteration, it wont be there.

    thanks,

    - Joel


    \
     
     \ /
      Last update: 2022-06-23 01:18    [W:4.094 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site