mm/compaction: add missing annotation for compact_lock_irqsave
authorJules Irenge <jbi.octave@gmail.com>
Tue, 7 Apr 2020 03:08:06 +0000 (20:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2020 17:43:41 +0000 (10:43 -0700)
Sparse reports a warning at compact_lock_irqsave()

warning: context imbalance in compact_lock_irqsave() - wrong count at exit

The root cause is the missing annotation at compact_lock_irqsave()
Add the missing __acquires(lock) annotation.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200214204741.94112-6-jbi.octave@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/compaction.c

index 46af63e..46f0fcc 100644 (file)
@@ -481,6 +481,7 @@ static bool test_and_set_skip(struct compact_control *cc, struct page *page,
  */
 static bool compact_lock_irqsave(spinlock_t *lock, unsigned long *flags,
                                                struct compact_control *cc)
+       __acquires(lock)
 {
        /* Track if the lock is contended in async mode */
        if (cc->mode == MIGRATE_ASYNC && !cc->contended) {