On Thu, 14 Sep 2023 15:27:03 +0200 Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote: > You should drop the '&& refcount_read(&shmem->pages_use_count)', > otherwise you'll never enter this branch (sgt allocation retained > a ref, so pages_use_count > 0 when ->sgt != NULL). Sorry for the brain fart. You can drop this extra test because its redundant (->sgt != NULL implies pages_use_count > 0), but it shouldn't prevent you from entering the branch.