Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android
From: Oleg Nesterov
Date: Thu May 16 2019 - 09:56:41 EST
On 05/15, Sultan Alsawaf wrote:
>
> On Wed, May 15, 2019 at 04:58:32PM +0200, Oleg Nesterov wrote:
> > Could you explain in detail what exactly did you do and what do you see in dmesg?
> >
> > Just in case, lockdep complains only once, print_circular_bug() does debug_locks_off()
> > so it it has already reported another false positive __lock_acquire() will simply
> > return after that.
> >
> > Oleg.
>
> This is what I did:
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 774ab79d3ec7..009e7d431a88 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -3078,6 +3078,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
> int class_idx;
> u64 chain_key;
>
> + BUG_ON(!debug_locks || !prove_locking);
> if (unlikely(!debug_locks))
> return 0;
>
> diff --git a/lib/debug_locks.c b/lib/debug_locks.c
> index 124fdf238b3d..4003a18420fb 100644
> --- a/lib/debug_locks.c
> +++ b/lib/debug_locks.c
> @@ -37,6 +37,7 @@ EXPORT_SYMBOL_GPL(debug_locks_silent);
> */
> int debug_locks_off(void)
> {
> + return 0;
> if (debug_locks && __debug_locks_off()) {
> if (!debug_locks_silent) {
> console_verbose();
OK, this means that debug_locks_off() always returns 0, as if debug_locks was already
cleared.
Thus print_deadlock_bug() will do nothing, it does
if (!debug_locks_off_graph_unlock() || debug_locks_silent)
return 0;
iow this means that even if lockdep finds a problem, the problem won't be reported.
> [ 1.492128] BUG: key 0000000000000000 not in .data!
> [ 1.492141] BUG: key 0000000000000000 not in .data!
> [ 1.492152] BUG: key 0000000000000000 not in .data!
> [ 1.492228] BUG: key 0000000000000000 not in .data!
> [ 1.492238] BUG: key 0000000000000000 not in .data!
> [ 1.492248] BUG: key 0000000000000000 not in .data!
I guess this is lockdep_init_map() which does printk("BUG:") itself, but due to your
change above it doesn't do WARN(1) and thus there is no call trace.
Oleg.