From: Andrew Morton ERROR: do not use assignment in if condition #627: FILE: mm/slub.c:2827: + if (!page->inuse && (state = slab_trylock(page))) { total: 1 errors, 0 warnings, 611 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Seems nicer this way. Should the `if (page->inuse)' test be marked unlikely()? Cc: Christoph Lameter Cc: Pekka Enberg Signed-off-by: Andrew Morton --- mm/slub.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff -puN mm/slub.c~slub-do-our-own-locking-via-slab_lock-and-slab_unlock-checkpatch-fixes mm/slub.c --- a/mm/slub.c~slub-do-our-own-locking-via-slab_lock-and-slab_unlock-checkpatch-fixes +++ a/mm/slub.c @@ -2821,20 +2821,23 @@ int kmem_cache_shrink(struct kmem_cache * list_lock. page->inuse here is the upper limit. */ list_for_each_entry_safe(page, t, &n->partial, lru) { - if (!page->inuse && (state = slab_trylock(page))) { - /* - * Must hold slab lock here because slab_free - * may have freed the last object and be - * waiting to release the slab. - */ - list_del(&page->lru); - n->nr_partial--; - slab_unlock(page, state); - discard_slab(s, page); - } else { + if (page->inuse) { list_move(&page->lru, slabs_by_inuse + page->inuse); + continue; } + state = slab_trylock(page); + if (!state) + continue; + /* + * Must hold slab lock here because slab_free may have + * freed the last object and be waiting to release the + * slab. + */ + list_del(&page->lru); + n->nr_partial--; + slab_unlock(page, state); + discard_slab(s, page); } /* _