LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-21-2022, 12:32 AM   #1
schai
LQ Newbie
 
Registered: Feb 2022
Posts: 4

Rep: Reputation: 0
Question Question about how page tables are freed


Running linux on x86.
I am looking at the function free_pgd_range. It walks through the radix tree page table and "free" the page table at each level. For example, at pte level, free_pte_range calls pte_free_tlb which update the tlb stats and call page destructor. I am confused because I don't know where the linux kernel actually free a page allocated for a page table when destroy a process and exit from its associated mm_struct.
I also look into pgd_free and zap_page_range functions; they are critical while exiting from a mm_struct, but I don't think they free any pages used for page tables.

Any insight/pointer would be helpful! Thanks in advance!

Last edited by schai; 04-21-2022 at 11:41 AM.
 
Old 04-21-2022, 11:02 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,670
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
This highly-technical question should be moved to Linux - Kernel.
 
Old 04-21-2022, 11:14 AM   #3
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Rep: Reputation: 32
This defers between 32 bit and 64 bit address(virtual).
if you go through this structure, you will find page table address. Out of this address, lower 12 bits used to refer address of particular page(Assuming that you have page size 4K), rest of the bits are used for multilevel-page table indexing.
 
Old 04-21-2022, 11:45 AM   #4
schai
LQ Newbie
 
Registered: Feb 2022
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by barunparichha View Post
This defers between 32 bit and 64 bit address(virtual).
if you go through this structure, you will find page table address. Out of this address, lower 12 bits used to refer address of particular page(Assuming that you have page size 4K), rest of the bits are used for multilevel-page table indexing.
Sorry I should have specified the arch well enough. I am running on x86-64. I know how those page tables are designed, but I guess my question in one sentence is that when and where do those page tables get freed?
 
Old 04-21-2022, 11:45 AM   #5
schai
LQ Newbie
 
Registered: Feb 2022
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sundialsvcs View Post
This highly-technical question should be moved to Linux - Kernel.
Thanks for the suggestion. Let me migrate it there.
 
Old 04-22-2022, 12:33 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Duplicate of https://www.linuxquestions.org/quest...ed-4175711085/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Tables of Contents, Indexes and Other Special Tables in Scribus LXer Syndicated Linux News 0 05-13-2011 05:30 AM
kernel 2.6.13 - space not freed to kernel sarunya Linux - General 6 09-02-2005 09:14 AM
Freeing unused kernel memory: 136k freed apenguinlinux Debian 8 08-08-2005 03:30 PM
RH & HP4050N PCL - page, pause, page, pause, page andguent Linux - Hardware 0 11-10-2003 08:35 AM
Freeing unused kernel memory: 228k freed bodedeb Linux - General 8 10-28-2003 03:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration