lkml.org 
[lkml]   [2023]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 1/3] delayacct: introduce delayacct_enabled() to simplify implement
    From

    在 2023/10/8 18:56, Peter Zijlstra 写道:
    > On Sun, Oct 08, 2023 at 06:49:36PM +0800, brookxu.cn wrote:
    >> From: Chunguang Xu <chunguang.xu@shopee.com>
    >>
    >> Introduce delayacct_enabled() to simplify the code and make it
    >> more concise.
    >>
    >> Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
    >> ---
    >> include/linux/delayacct.h | 74 +++++++++++----------------------------
    >> kernel/delayacct.c | 2 +-
    >> 2 files changed, 21 insertions(+), 55 deletions(-)
    >>
    >> diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
    >> index 6639f48dac36..660e534ce7c4 100644
    >> --- a/include/linux/delayacct.h
    >> +++ b/include/linux/delayacct.h
    >> @@ -94,137 +94,103 @@ static inline void delayacct_tsk_init(struct task_struct *tsk)
    >> __delayacct_tsk_init(tsk);
    >> }
    >>
    >> +static inline bool delayacct_enabled(void)
    >> +{
    >> + return static_branch_unlikely(&delayacct_key);
    >> +}
    >> +
    >> /* Free tsk->delays. Called from bad fork and __put_task_struct
    >> * where there's no risk of tsk->delays being accessed elsewhere
    >> */
    >> static inline void delayacct_tsk_free(struct task_struct *tsk)
    >> {
    >> - if (tsk->delays)
    >> + if (delayacct_enabled())
    > This isn't an equivalent change and your Changelog does not clarify.
    Sorry, As Patch 2 will convert tsk->delays to object,  we donot need to
    check whether tsk->delays is null or not, so relative code can be simplify.

    \
     
     \ /
      Last update: 2023-10-08 19:19    [W:2.737 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site