Re: [PATCH v1 08/17] mm/rmap: initial MM owner tracking for large folios (!hugetlb)

From: Kirill A. Shutemov
Date: Wed Oct 23 2024 - 09:09:16 EST


On Thu, Aug 29, 2024 at 06:56:11PM +0200, David Hildenbrand wrote:
> +#ifdef CONFIG_MM_ID
> +/*
> + * For init_mm and friends, we don't allocate an ID and use the dummy value
> + * instead. Limit ourselves to 1M MMs for now: even though we might support
> + * up to 4M PIDs, having more than 1M MM instances is highly unlikely.
> + */

Hm. Should we lower PID_MAX_LIMIT limit then?

Also, do we really need IDA? Can't we derive the ID from mm_struct
address?

> +#define MM_ID_DUMMY 0
> +#define MM_ID_NR_BITS 20
> +#define MM_ID_MIN (MM_ID_DUMMY + 1)
> +#define MM_ID_MAX ((1U << MM_ID_NR_BITS) - 1)
> +#endif /* CONFIG_MM_ID */
> +
> #define MM_MT_FLAGS (MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN | \
> MT_FLAGS_USE_RCU)
> extern struct mm_struct init_mm;

--
Kiryl Shutsemau / Kirill A. Shutemov