LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-06-2013, 09:16 AM   #1
eviatarkhen
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Rep: Reputation: 0
Releasing a page frame


Hi All,

I'm writting a kernel module that manages memory pages for user space (stack allocations for micro thread).
It seems that I have a bug during the release of a physical page.
The unitest I'm doing is to write for each page at the allocaed memory (allocated with vmalloc), causing initially to page fault, and then call the kernel module to release each page frame. After the release, a write would cause a page fault. Repeating this procedure causes something very cool - when I look at "top" I see that the physical memory keeps increasing (similar to a memory leak) but the virtual memory remains the same. The increase is steady and even passes my actual memory size (got 88 giga for 8 giga memory!!!!!). Nevertheless the application is not crashing, nor use swapping area. This makes me think that this is a counters problem.
So, it seems like that each page fault increases some counters, but my hand made release fails to do that. Actually I only use "pte_clear()" for each page I want to release.
Using "__page_free()" does not solve the problem, and "page_free()" causes a kernel panic.
Does anyone have any idea for a direction I could investigate?
Maybe someone knows some similar driver I could referenc?

Thank you and best regards,

Eviatar
 
Old 01-06-2013, 02:08 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
How do you allocate and free the pages now?
 
Old 01-07-2013, 02:21 AM   #3
eviatarkhen
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Looks like I found the problem.
Apperantly, in a page fault the kernel preforms "inc_mm_counter()".
Because I relaesed the page table entry by myself, this counter keeped increasing for each page fault.
Adding dec_mm_counter() after the pte_clear() seems to solve the issue.

Thanks a lot,

Eviatar
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
In a x86 arch, where is the page descriptor of a page frame stored? sudarg Linux - Newbie 0 03-31-2009 03:57 AM
frame-by-frame editing for dv home movie marcia Linux - Software 3 03-05-2009 10:32 PM
calling a frame from another frame : JAVA randomx Programming 0 10-07-2004 02:49 PM
i cant link a php frame to another page meluser Linux - Software 0 03-14-2003 11:17 PM
Page vs. Frame mikeshn Linux - General 3 05-06-2002 09:49 PM


All times are GMT -5. The time now is 06:53 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration