All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jeff Xie <jeff.xie@linux.dev>
Cc: akpm@linux-foundation.org, iamjoonsoo.kim@lge.com,
	vbabka@suse.cz, cl@linux.com, penberg@kernel.org,
	rientjes@google.com, roman.gushchin@linux.dev,
	42.hyeyoo@gmail.com, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	chensong_2000@189.cn, xiehuan09@gmail.com
Subject: Re: [RFC][PATCH 1/4] mm, page_owner: add folio allocate post callback for struct page_owner to make the owner clearer
Date: Thu, 9 Nov 2023 13:59:45 +0000	[thread overview]
Message-ID: <ZUzl0U++a5fRpCQm@casper.infradead.org> (raw)
In-Reply-To: <20231109032521.392217-2-jeff.xie@linux.dev>

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

  reply	other threads:[~2023-11-09 14:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09  3:25 [RFC][PATCH 0/4] mm, page_owner: make the owner in page owner clearer Jeff Xie
2023-11-09  3:25 ` [RFC][PATCH 1/4] mm, page_owner: add folio allocate post callback for struct page_owner to make the " Jeff Xie
2023-11-09 13:59   ` Matthew Wilcox [this message]
2023-11-09 15:25     ` Jeff Xie
2023-11-09 15:36       ` Matthew Wilcox
2023-11-09 16:04       ` jeff.xie
2023-11-09 16:38         ` Matthew Wilcox
2023-11-09  3:25 ` [RFC][PATCH 2/4] mm, slub: implement slub allocate post callback for page_owner Jeff Xie
2023-11-09 14:05   ` Matthew Wilcox
2023-11-09 15:34   ` jeff.xie
2023-11-09  3:25 ` [RFC][PATCH 3/4] filemap: implement filemap " Jeff Xie
2023-11-09 14:09   ` Matthew Wilcox
2023-11-09 15:43   ` jeff.xie
2023-11-09 15:46     ` Matthew Wilcox
2023-11-09 22:16   ` kernel test robot
2023-11-09  3:25 ` [RFC][PATCH 4/4] mm/rmap: implement anonmap " Jeff Xie
2023-11-09 14:10   ` Matthew Wilcox
2023-11-09 15:47   ` jeff.xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZUzl0U++a5fRpCQm@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chensong_2000@189.cn \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jeff.xie@linux.dev \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    --cc=xiehuan09@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.