lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 26/28] locking/lockdep: Remove __bfs
    Date
    Since there is no need for backward dependecy searching, remove this
    extra function layer.

    Signed-off-by: Yuyang Du <duyuyang@gmail.com>
    ---
    kernel/locking/lockdep.c | 40 +++++++---------------------------------
    1 file changed, 7 insertions(+), 33 deletions(-)

    diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
    index 06ae87f..acaa3b3 100644
    --- a/kernel/locking/lockdep.c
    +++ b/kernel/locking/lockdep.c
    @@ -1393,27 +1393,13 @@ static inline int get_lock_depth(struct lock_list *child)
    }

    /*
    - * Return the forward or backward dependency list.
    - *
    - * @lock: the lock_list to get its class's dependency list
    - * @offset: the offset to struct lock_class to determine whether it is
    - * locks_after or locks_before
    - */
    -static inline struct list_head *get_dep_list(struct lock_list *lock, int offset)
    -{
    - void *lock_class = lock->class;
    -
    - return lock_class + offset;
    -}
    -
    -/*
    - * Forward- or backward-dependency search, used for both circular dependency
    + * Forward-dependency search, used for both circular dependency
    * checking and hardirq-unsafe/softirq-unsafe checking.
    */
    -static int __bfs(struct lock_list *source_entry, void *data,
    - int (*match)(struct lock_list *entry, void *data),
    - struct lock_list **target_entry, int offset, int index,
    - int distance, struct lock_class *safe_lock, bool reach)
    +static int __bfs_forwards(struct lock_list *source_entry, void *data,
    + int (*match)(struct lock_list *entry, void *data),
    + struct lock_list **target_entry, int index,
    + int distance, struct lock_class *safe_lock, bool reach)
    {
    struct lock_list *entry;
    struct lock_list *lock;
    @@ -1429,7 +1415,7 @@ static int __bfs(struct lock_list *source_entry, void *data,
    goto exit;
    }

    - head = get_dep_list(source_entry, offset);
    + head = &source_entry->class->locks_after;
    if (list_empty(head))
    goto exit;

    @@ -1443,7 +1429,7 @@ static int __bfs(struct lock_list *source_entry, void *data,
    goto exit;
    }

    - head = get_dep_list(lock, offset);
    + head = &lock->class->locks_after;

    DEBUG_LOCKS_WARN_ON(!irqs_disabled());

    @@ -1475,18 +1461,6 @@ static int __bfs(struct lock_list *source_entry, void *data,
    return ret;
    }

    -static inline int __bfs_forwards(struct lock_list *src_entry, void *data,
    - int (*match)(struct lock_list *entry, void *data),
    - struct lock_list **target_entry, int index,
    - int distance, struct lock_class *safe_lock,
    - bool reach)
    -{
    - return __bfs(src_entry, data, match, target_entry,
    - offsetof(struct lock_class, locks_after),
    - index, distance, safe_lock, reach);
    -
    -}
    -
    static void print_lock_trace(struct lock_trace *trace, unsigned int spaces)
    {
    unsigned long *entries = stack_trace + trace->offset;
    --
    1.8.3.1
    \
     
     \ /
      Last update: 2019-04-24 12:23    [W:4.196 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site