[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUzl0U++a5fRpCQm@casper.infradead.org>
Date: Thu, 9 Nov 2023 13:59:45 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Jeff Xie <jeff.xie@...ux.dev>
Cc: akpm@...ux-foundation.org, iamjoonsoo.kim@....com, vbabka@...e.cz,
cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
chensong_2000@....cn, xiehuan09@...il.com
Subject: Re: [RFC][PATCH 1/4] mm, page_owner: add folio allocate post
callback for struct page_owner to make the owner clearer
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
Powered by blists - more mailing lists