Re: [RFC][PATCH 1/4] mm, page_owner: add folio allocate post callback for struct page_owner to make the owner clearer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 09, 2023 at 11:25:18AM +0800, Jeff Xie wrote:
> adding a callback function in the struct page_owner to let the slab layer or the
> anon/file handler layer or any other memory-allocated layers to implement what
> they would like to tell.

There's no need to add a callback.  We can tell what a folio is.

> +	if (page_owner->folio_alloc_post_page_owner) {
> +		rcu_read_lock();
> +		tsk = find_task_by_pid_ns(page_owner->pid, &init_pid_ns);
> +		rcu_read_unlock();
> +		ret += page_owner->folio_alloc_post_page_owner(page_folio(page), tsk, page_owner->data,
> +				kbuf + ret, count - ret);
> +	} else
> +		ret += scnprintf(kbuf + ret, count - ret, "OTHER_PAGE\n");

	if (folio_test_slab(folio))
		ret += slab_page_owner_info(folio, kbuf + ret, count - ret);
	else if (folio_test_anon(folio))
		ret += anon_page_owner_info(folio, kbuf + ret, count - ret);
	else if (folio_test_movable(folio))
		ret += null_page_owner_info(folio, kbuf + ret, count - ret);
	else if (folio->mapping)
		ret += file_page_owner_info(folio, kbuf + ret, count - ret);
	else
		ret += null_page_owner_info(folio, kbuf + ret, count - ret);

In this scenario, I have the anon handling ksm pages, but if that's not
desirable, we can add

	else if (folio_test_ksm(folio))
		ret += ksm_page_owner_info(folio, kbuf + ret, count - ret);

right before the folio_test_anon() clause




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux