kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: linux lover <caprianking2002@gmail.com>
To: Wonkyo Choe <heysid3@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: How to free a page table page
Date: Tue, 6 Apr 2021 06:12:11 +0800	[thread overview]
Message-ID: <36EF65EA-60C9-4E91-B89E-9E9FE960CF43@gmail.com> (raw)
In-Reply-To: <CAH81q328dUCL09dnZmCKd04jgvVVrxj1RNe47SZTsUrAAo9dUw@mail.gmail.com>

I really appreciate it!

Sent from my iPhone

> On Apr 5, 2021, at 11:39 PM, Wonkyo Choe <heysid3@gmail.com> wrote:
> 
> Hello there,
> 
> I'm trying to manage a custom page table list for my toy project.
> A basic process of the custom list is to allocate few pages (struct page)
> to the list from the buddy allocator and the list will give some pages
> when a user process needs page table pages. In contrast, when this
> process terminates,
> page table pages will return to the list. Finally, when the list is
> not needed, all pages will be
> delivered to the buddy allocator.
> 
> This relationship can be described as:
>    process - custom list - buddy allocator
> 
> My problem is that a user process' page table pages (pud, pmd, pte)
> seem to free their
> page to the buddy allocator instead of to the custom list. (allocation
> works. I've checked it)
> I put my custom functions in release_pages / free_unref_page /
> free_unref_page_list,
> but somehow the functions do not work as I intended. (Actually the
> functions are not
> called so I may choose the wrong functions.)
> 
> So, I was wondering whether I intercepted the right functions (three
> functions above).
> Also, I have a question about freeing a page-table page.
> 
> 1. In x86, are all page-table pages released at the end of termination
> by using free_pgtables()?
> 2. In x86, a page-table page can be freed when there is no entry? In
> other words, does the Linux kernel
> release a page-table page on runtime? If so, what function would do
> this kind of task?
> I'm trying to find freeing functions, but I can't find them and I'm
> not sure when this kind of function is called.
> (I'm pretty sure that pte_free / pmd_free / pud_free functions are not
> for this case.)
> 
> Any help would be greatly appreciated.
> 
> Regards,
> Wonkyo
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2021-04-05 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 15:39 How to free a page table page Wonkyo Choe
2021-04-05 22:12 ` linux lover [this message]
2021-04-06  2:42 ` Rik van Riel
2021-04-06  6:30   ` Wonkyo Choe

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=36EF65EA-60C9-4E91-B89E-9E9FE960CF43@gmail.com \
    --to=caprianking2002@gmail.com \
    --cc=heysid3@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).