Re: [PATCH 2/2] mm: introduce __GFP_TRACKLEAK to track in-kernel allocation

From: Matthew Wilcox
Date: Wed Sep 14 2022 - 04:27:13 EST


On Wed, Sep 14, 2022 at 11:37:01AM +0800, zhaoyang.huang wrote:
> ---
> v2: code update
> v3: update code and Documentation

This is really not good enough. What changed?

The documentation is also not good enough. It needs to mention:

- This cannot be used for GFP_HIGHMEM allocations.
- This cannot be used for pages which are mapped into userspace.

I also still want to see selftests. order-0, order-N (with and without
__GFP_COMP). What happens if you allocate an order-N page without
GFP_COMP, take an extra ref on the first page, call free_pages() and
then one of the recently-freed pages is allocated again while you still
have the reference on the first page?

I believe Andrew also suggested that

if (PageTrackleak(page))

become always-false if the CONFIG option is disabled.

> +#ifdef CONFIG_HAVE_DEBUG_KMEMLEAK

This is the wrong CONFIG option, it should be CONFIG_DEBUG_KMEMLEAK.


Add to this the very real question of how useful is this, and I'm not
getting warm fuzzy feelings about where this patchset is heading.