* [Help] : RSS/PSS showing 0 during smaps for Xorg [not found] <1327310360.96918.YahooMailNeo@web162003.mail.bf1.yahoo.com> @ 2012-01-23 10:15 ` PINTU KUMAR 2012-01-23 19:31 ` Hugh Dickins 0 siblings, 1 reply; 8+ messages in thread From: PINTU KUMAR @ 2012-01-23 10:15 UTC (permalink / raw) To: linux-kernel, linux-mm Dear All, I am facing one problem for one of my kernel module for our linux mobile with kernel2.6.36. When I do cat /proc/<Xorg pid>/smaps | grep -A 11 /dev/ump , to track information for my ump module, we always get Rss/Pss as 0 kB as shown below: cat /proc/1731/smaps | grep -A 11 /dev/ump 414db000-415ff000 rw-s 00015000 00:12 6803 /dev/ump Size: 1168 kB Rss: 0 kB Pss: 0 kB track_rss_value = 0, iswalkcalled = 1, smap_pte_range_called = 1, swap_pte = 0, not_pte_present = 0, not_normal_page = 1 isspecial = 0, not_special = 1, isMixedMap = 0, pfnpages_null = 0, pfnoff_flag = 0, not_cow_mapping = 1, normal_page_end = 0 After tracing down the problem, I found out that during "show_smaps" in fs/proc/task_mmu.c and during call to smaps_pte_range the vm_normal_page() is always returning NULL for our /dev/ump driver. (smaps_pte_range() is the place where Rss/Pss information is populated) Thus mss->resident (Rss value) is never getting incremented. To trace the problem I added few flags during show_smaps & vm_normal_page() as shown above. The value of 1 indicates that the condition is executed. Thus "normal_page_end" indicates that the "vm_normal_page" has never ended successfully and always returns from "!is_cow_mapping()". So, I wanted to know the main cause for vm_normal_page() always returning NULL page for our ump driver. What is that I am missing in my driver ? Can anyone please let me know what could be the problem in our driver. Thanks. With Regards, Pintu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-23 10:15 ` [Help] : RSS/PSS showing 0 during smaps for Xorg PINTU KUMAR @ 2012-01-23 19:31 ` Hugh Dickins 2012-01-25 5:22 ` PINTU KUMAR 0 siblings, 1 reply; 8+ messages in thread From: Hugh Dickins @ 2012-01-23 19:31 UTC (permalink / raw) To: PINTU KUMAR; +Cc: linux-kernel, linux-mm On Mon, 23 Jan 2012, PINTU KUMAR wrote: > Dear All, > > I am facing one problem for one of my kernel module for our linux mobile with kernel2.6.36. > > When I do cat /proc/<Xorg pid>/smaps | grep -A 11 /dev/ump , to track information for my ump module, > we always get Rss/Pss as 0 kB as shown below: > cat /proc/1731/smaps | grep -A 11 /dev/ump > 414db000-415ff000 rw-s 00015000 00:12 6803 /dev/ump > Size: 1168 kB > Rss: 0 kB > Pss: 0 kB > track_rss_value = 0, iswalkcalled = 1, smap_pte_range_called = 1, swap_pte = 0, not_pte_present = 0, not_normal_page = 1 > isspecial = 0, not_special = 1, isMixedMap = 0, pfnpages_null = 0, pfnoff_flag = 0, not_cow_mapping = 1, normal_page_end = 0 > > After tracing down the problem, I found out that during "show_smaps" in fs/proc/task_mmu.c and during call to smaps_pte_range the vm_normal_page() is always returning NULL for our /dev/ump driver. > (smaps_pte_range() is the place where Rss/Pss information is populated) > Thus mss->resident (Rss value) is never getting incremented. > > To trace the problem I added few flags during show_smaps & vm_normal_page() as shown above. The value of 1 indicates that the condition is executed. > Thus "normal_page_end" indicates that the "vm_normal_page" has never ended successfully and always returns from > "!is_cow_mapping()". > > So, I wanted to know the main cause for vm_normal_page() always returning NULL page for our ump driver. > What is that I am missing in my driver ? > > Can anyone please let me know what could be the problem in our driver. This not evidence of any problem in your driver. vm_normal_page() returns NULL because the pages mapped by your driver are not normal faultable and reclaimable pages, but an area of physical memory mapped in by remap_pfn_range(), which sets the VM_PFNMAP flag. The mm subsystem does not count such pages towards rss (or pss), hence your 0s. Hugh ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-23 19:31 ` Hugh Dickins @ 2012-01-25 5:22 ` PINTU KUMAR 2012-01-26 0:59 ` Hugh Dickins 0 siblings, 1 reply; 8+ messages in thread From: PINTU KUMAR @ 2012-01-25 5:22 UTC (permalink / raw) To: Hugh Dickins; +Cc: linux-kernel, linux-mm ________________________________ >From: Hugh Dickins <hughd@google.com> >To: PINTU KUMAR <pintu_agarwal@yahoo.com> >Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>; "linux-mm@kvack.org" <linux-mm@kvack.org> >Sent: Tuesday, 24 January 2012 1:01 AM >Subject: Re: [Help] : RSS/PSS showing 0 during smaps for Xorg > >On Mon, 23 Jan 2012, PINTU KUMAR wrote: >> Dear All, >> >> I am facing one problem for one of my kernel module for our linux mobile with kernel2.6.36. >> >> When I do cat /proc/<Xorg pid>/smaps | grep -A 11 /dev/ump , to track information for my ump module, >> we always get Rss/Pss as 0 kB as shown below: >> cat /proc/1731/smaps | grep -A 11 /dev/ump >> 414db000-415ff000 rw-s 00015000 00:12 6803 /dev/ump >> Size: 1168 kB >> Rss: 0 kB >> Pss: 0 kB >> track_rss_value = 0, iswalkcalled = 1, smap_pte_range_called = 1, swap_pte = 0, not_pte_present = 0, not_normal_page = 1 >> isspecial = 0, not_special = 1, isMixedMap = 0, pfnpages_null = 0, pfnoff_flag = 0, not_cow_mapping = 1, normal_page_end = 0 >> >> After tracing down the problem, I found out that during "show_smaps" in fs/proc/task_mmu.c and during call to smaps_pte_range the vm_normal_page() is always returning NULL for our /dev/ump driver. >> (smaps_pte_range() is the place where Rss/Pss information is populated) >> Thus mss->resident (Rss value) is never getting incremented. >> >> To trace the problem I added few flags during show_smaps & vm_normal_page() as shown above. The value of 1 indicates that the condition is executed. >> Thus "normal_page_end" indicates that the "vm_normal_page" has never ended successfully and always returns from >> "!is_cow_mapping()". >> >> So, I wanted to know the main cause for vm_normal_page() always returning NULL page for our ump driver. >> What is that I am missing in my driver ? >> >> Can anyone please let me know what could be the problem in our driver. > >This not evidence of any problem in your driver. > >vm_normal_page() returns NULL because the pages mapped by your driver >are not normal faultable and reclaimable pages, but an area of physical >memory mapped in by remap_pfn_range(), which sets the VM_PFNMAP flag. > >The mm subsystem does not count such pages towards rss (or pss), >hence your 0s. > >Hugh > Dear Mr. Hugh, Thank you very much for your reply. Is there a way to convert our mapped pages to a normal pages. I tried pfn_to_page() but no effect. I mean the page is considered normal only if it is associated with "struct page" right??? Is is possible to convert these pages to a normal struct pages so that we can get the Rss/Pss value?? Also, the VM_PFNMAP is being set for all dirvers during remap_pfn_range and stills shows Rss/Pss for other drivers. Then why it is not shown for our driver? How to avoid remap_pfn_range to not to set VM_PFNMAP for our driver? Please let me know. Thanks, Regards, Pintu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-25 5:22 ` PINTU KUMAR @ 2012-01-26 0:59 ` Hugh Dickins 2012-01-30 8:42 ` PINTU KUMAR 0 siblings, 1 reply; 8+ messages in thread From: Hugh Dickins @ 2012-01-26 0:59 UTC (permalink / raw) To: PINTU KUMAR; +Cc: linux-kernel, linux-mm [-- Attachment #1: Type: TEXT/PLAIN, Size: 1719 bytes --] On Tue, 24 Jan 2012, PINTU KUMAR wrote: > > Is there a way to convert our mapped pages to a normal pages. I tried pfn_to_page() but no effect. > I mean the page is considered normal only if it is associated with "struct page" right??? > Is is possible to convert these pages to a normal struct pages so that we can get the Rss/Pss value?? I don't understand why you are so anxious to see non-0 numbers there. I don't know if the pages you are mapping with remap_pfn_range() are ordinary pages in normal memory, and so already have struct pages, or not. > > Also, the VM_PFNMAP is being set for all dirvers during remap_pfn_range and stills shows Rss/Pss for other drivers. I'm surprised. It is possible to set up a private-writable VM_PFNMAP area, which can then contain ordinary private copies of the underlying pages, and these copies will count to Rss. But I thought that was very unusual. You don't mention which drivers these are that use remap_pfn_range yet show Rss (and I don't particularly want to spend time researching them). I can see three or four places in drivers/ where VM_PFNMAP is set, perhaps without going through remap_pfn_range(): that seems prone to error, I wouldn't recommend going that route. > Then why it is not shown for our driver? > How to avoid remap_pfn_range to not to set VM_PFNMAP for our driver? If these are ordinary pages with struct pages, then you could probably use a loop of vm_insert_page()s to insert them at mmap time, or a fault routine to insert them on fault. But as I said, I don't know if this memory is part of the ordinary page pool or not. Really, the question has to be, why do you need to see non-0s there? Hugh ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-26 0:59 ` Hugh Dickins @ 2012-01-30 8:42 ` PINTU KUMAR 2012-01-30 18:49 ` Hugh Dickins 0 siblings, 1 reply; 8+ messages in thread From: PINTU KUMAR @ 2012-01-30 8:42 UTC (permalink / raw) To: Hugh Dickins; +Cc: linux-kernel, linux-mm Dear Hugh Dickins, Thank you very much for your reply. >If these are ordinary pages with struct pages, then you could probably >use a loop of vm_insert_page()s to insert them at mmap time, or a fault >routine to insert them on fault. But as I said, I don't know if this >memory is part of the ordinary page pool or not. You suggestion about using vm_insert_page() instead of remap_pfn_range worked for me and I got the Rss/Pss information for my driver. But still there is one problem related to page fault. If I remove remap_pfn_range then I get a page fault in the beginning. I tried to use the same vm_insert_page() during page_fault_handler for each vmf->virtual_address but it did not work. So for time being I remove the page fault handler from my vm_operations. But with these my menu screen(LCD screen) is not behaving properly (I get colorful lines on my LCD). So I need to handle the page fault properly. But I am not sure what is that I need to do inside page fault handler. Do you have any example or references or suggestions? >Really, the question has to be, why do you need to see non-0s there? I want Rss/Pss value to account for how much video memory is used by the driver for the menu-screen,Xorg processes. Thanks, Pintu >________________________________ >From: Hugh Dickins <hughd@google.com> >To: PINTU KUMAR <pintu_agarwal@yahoo.com> >Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>; "linux-mm@kvack.org" <linux-mm@kvack.org> >Sent: Thursday, 26 January 2012 6:29 AM >Subject: Re: [Help] : RSS/PSS showing 0 during smaps for Xorg > >On Tue, 24 Jan 2012, PINTU KUMAR wrote: >> >> Is there a way to convert our mapped pages to a normal pages. I tried pfn_to_page() but no effect. >> I mean the page is considered normal only if it is associated with "struct page" right??? >> Is is possible to convert these pages to a normal struct pages so that we can get the Rss/Pss value?? > >I don't understand why you are so anxious to see non-0 numbers there. > >I don't know if the pages you are mapping with remap_pfn_range() are >ordinary pages in normal memory, and so already have struct pages, or not. > >> >> Also, the VM_PFNMAP is being set for all dirvers during remap_pfn_range and stills shows Rss/Pss for other drivers. > >I'm surprised. It is possible to set up a private-writable VM_PFNMAP area, >which can then contain ordinary private copies of the underlying pages, >and these copies will count to Rss. But I thought that was very unusual. > >You don't mention which drivers these are that use remap_pfn_range yet >show Rss (and I don't particularly want to spend time researching them). > >I can see three or four places in drivers/ where VM_PFNMAP is set, >perhaps without going through remap_pfn_range(): that seems prone >to error, I wouldn't recommend going that route. > >> Then why it is not shown for our driver? >> How to avoid remap_pfn_range to not to set VM_PFNMAP for our driver? > >If these are ordinary pages with struct pages, then you could probably >use a loop of vm_insert_page()s to insert them at mmap time, or a fault >routine to insert them on fault. But as I said, I don't know if this >memory is part of the ordinary page pool or not. > >Really, the question has to be, why do you need to see non-0s there? > >Hugh > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-30 8:42 ` PINTU KUMAR @ 2012-01-30 18:49 ` Hugh Dickins 2012-02-01 14:49 ` PINTU KUMAR 0 siblings, 1 reply; 8+ messages in thread From: Hugh Dickins @ 2012-01-30 18:49 UTC (permalink / raw) To: PINTU KUMAR; +Cc: linux-kernel, linux-mm [-- Attachment #1: Type: TEXT/PLAIN, Size: 2331 bytes --] On Mon, 30 Jan 2012, PINTU KUMAR wrote: > > >If these are ordinary pages with struct pages, then you could probably > >use a loop of vm_insert_page()s to insert them at mmap time, or a fault > >routine to insert them on fault. But as I said, I don't know if this > >memory is part of the ordinary page pool or not. > > You suggestion about using vm_insert_page() instead of remap_pfn_range worked for me and I got the Rss/Pss information for my driver. Oh, I'm glad that happened to work for you. > But still there is one problem related to page fault. > If I remove remap_pfn_range then I get a page fault in the beginning. > I tried to use the same vm_insert_page() during page_fault_handler for each vmf->virtual_address but it did not work. > So for time being I remove the page fault handler from my vm_operations. > But with these my menu screen(LCD screen) is not behaving properly (I get colorful lines on my LCD). > So I need to handle the page fault properly. > > But I am not sure what is that I need to do inside page fault handler. Do you have any example or references or suggestions? Sounds like you're not using vm_insert_page() properly: I would not expect you to get a page fault there once you've set up the area with a loop of vm_insert_page()s. Check the comments above it in mm/memory.c ("Your vma protection will have to be set up correctly" might be relevant). Compare how you're using it with other users of vm_insert_page() in the kernel tree. Sorry, I don't have time to do your debugging. > > >Really, the question has to be, why do you need to see non-0s there? > I want Rss/Pss value to account for how much video memory is used by the driver for the menu-screen,Xorg processes. So, userspace does an mmap for a large-enough window, but only some part of that is filled by the driver (whether by remap_pfn_range or vm_insert_pages), and you'd like to communicate back how much via the Rss, instead of adding some ioctl or sysfs interface to the driver? Fair enough. I expect userspace could also work it out by touching pages of the area until it gets a SIGBUS, but that might be too dirty a way of finding out. Hmm, SIGBUS: maybe that's related to the faults that are puzzling you: perhaps you're mapping less than you need to. Hugh ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-01-30 18:49 ` Hugh Dickins @ 2012-02-01 14:49 ` PINTU KUMAR 2012-02-02 5:20 ` Hugh Dickins 0 siblings, 1 reply; 8+ messages in thread From: PINTU KUMAR @ 2012-02-01 14:49 UTC (permalink / raw) To: Hugh Dickins; +Cc: linux-kernel, linux-mm Dear Hugh, Thank you for your help/suggestion so far. Please find further updates on this below. >Sounds like you're not using vm_insert_page() properly: I would not expect >you to get a page fault there once you've set up the area with a loop of >vm_insert_page()s. >perhaps you're mapping less than you need to. 1) The page fault is not occuring now after calling vm_insert_page() in a loop for every page. The hint about "mapping less than you need to" stricked me. Please check the snapshot below. loop vm_insert_page(vma,start,page); start = start + PAGE_SIZE; size = size - PAGE_SIZE; until size > 0 I verified other drivers in kernel code and found this is how it is done. 2) But after doing all this also my menu-screen is not proper. Still I am getting colorful lines on the menu-screen. Can you point me out what could be the problem?? Thanks, Regards, Pintu >________________________________ >From: Hugh Dickins <hughd@google.com> >To: PINTU KUMAR <pintu_agarwal@yahoo.com> >Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>; "linux-mm@kvack.org" <linux-mm@kvack.org> >Sent: Tuesday, 31 January 2012 12:19 AM >Subject: Re: [Help] : RSS/PSS showing 0 during smaps for Xorg > >On Mon, 30 Jan 2012, PINTU KUMAR wrote: >> >> >If these are ordinary pages with struct pages, then you could probably >> >use a loop of vm_insert_page()s to insert them at mmap time, or a fault >> >routine to insert them on fault. But as I said, I don't know if this >> >memory is part of the ordinary page pool or not. >> >> You suggestion about using vm_insert_page() instead of remap_pfn_range worked for me and I got the Rss/Pss information for my driver. > >Oh, I'm glad that happened to work for you. > >> But still there is one problem related to page fault. >> If I remove remap_pfn_range then I get a page fault in the beginning. >> I tried to use the same vm_insert_page() during page_fault_handler for each vmf->virtual_address but it did not work. >> So for time being I remove the page fault handler from my vm_operations. >> But with these my menu screen(LCD screen) is not behaving properly (I get colorful lines on my LCD). >> So I need to handle the page fault properly. >> >> But I am not sure what is that I need to do inside page fault handler. Do you have any example or references or suggestions? > >Sounds like you're not using vm_insert_page() properly: I would not expect >you to get a page fault there once you've set up the area with a loop of >vm_insert_page()s. > >Check the comments above it in mm/memory.c ("Your vma protection will >have to be set up correctly" might be relevant). > >Compare how you're using it with other users of vm_insert_page() in >the kernel tree. Sorry, I don't have time to do your debugging. > >> >> >Really, the question has to be, why do you need to see non-0s there? >> I want Rss/Pss value to account for how much video memory is used by the driver for the menu-screen,Xorg processes. > >So, userspace does an mmap for a large-enough window, but only some part of >that is filled by the driver (whether by remap_pfn_range or vm_insert_pages), >and you'd like to communicate back how much via the Rss, instead of adding >some ioctl or sysfs interface to the driver? Fair enough. > >I expect userspace could also work it out by touching pages of the area >until it gets a SIGBUS, but that might be too dirty a way of finding out. > >Hmm, SIGBUS: maybe that's related to the faults that are puzzling you: >perhaps you're mapping less than you need to. > >Hugh > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Help] : RSS/PSS showing 0 during smaps for Xorg 2012-02-01 14:49 ` PINTU KUMAR @ 2012-02-02 5:20 ` Hugh Dickins 0 siblings, 0 replies; 8+ messages in thread From: Hugh Dickins @ 2012-02-02 5:20 UTC (permalink / raw) To: PINTU KUMAR; +Cc: linux-kernel, linux-mm [-- Attachment #1: Type: TEXT/PLAIN, Size: 260 bytes --] On Wed, 1 Feb 2012, PINTU KUMAR wrote: > > 2) But after doing all this also my menu-screen is not proper. > Still I am getting colorful lines on the menu-screen. > Can you point me out what could be the problem?? Sorry, I do not know. Hugh ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-02-02 5:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1327310360.96918.YahooMailNeo@web162003.mail.bf1.yahoo.com> 2012-01-23 10:15 ` [Help] : RSS/PSS showing 0 during smaps for Xorg PINTU KUMAR 2012-01-23 19:31 ` Hugh Dickins 2012-01-25 5:22 ` PINTU KUMAR 2012-01-26 0:59 ` Hugh Dickins 2012-01-30 8:42 ` PINTU KUMAR 2012-01-30 18:49 ` Hugh Dickins 2012-02-01 14:49 ` PINTU KUMAR 2012-02-02 5:20 ` Hugh Dickins
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).