All of lore.kernel.org
 help / color / mirror / Atom feed
* rmap.c: try_to_unmap_file(): VM_LOCKED not respected
@ 2005-06-14  5:14 li nux
  2005-06-14  5:22 ` William Lee Irwin III
  2005-06-14 13:51 ` Hugh Dickins
  0 siblings, 2 replies; 6+ messages in thread
From: li nux @ 2005-06-14  5:14 UTC (permalink / raw)
  To: linux

My application is using remap_file_pages and mlocks
those pages.
So in the code of  try_to_unmap_file (see below),
I should never reach the call to try_to_unmap_cluster,
because for those pages VM_LOCKED is always set.
But, under heavy load I am seeing try_to_unmap_cluster
is getting called. Stack:
try_to_unmap_cluster
try_to_unmap_file
try_to_unmap
shrink_list
__pagevec_release
shrink_cache
shrink_zone
balance_pgdat
prepare_to_wait
kswapd


Any idea why VM_LOCKED is not being respected ?

   do {
 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
                                                
shared.vm_set.list) {
     if (vma->vm_flags & (VM_LOCKED|VM_RESERVED))
              continue;
    cursor = (unsigned long) vma->vm_private_data;
while (vma->vm_mm->rss &&
cursor < max_nl_cursor &&                             
   cursor < vma->vm_end - vma->vm_start) {
                                
try_to_unmap_cluster(cursor, &mapcount, vma);
        cursor += CLUSTER_SIZE;
}
.....<snip>
   } while (max_nl_cursor <= max_nl_size);

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: rmap.c: try_to_unmap_file(): VM_LOCKED not respected
  2005-06-14  5:14 rmap.c: try_to_unmap_file(): VM_LOCKED not respected li nux
@ 2005-06-14  5:22 ` William Lee Irwin III
  2005-06-14  5:48   ` li nux
  2005-06-14 13:51 ` Hugh Dickins
  1 sibling, 1 reply; 6+ messages in thread
From: William Lee Irwin III @ 2005-06-14  5:22 UTC (permalink / raw)
  To: li nux; +Cc: linux

On Mon, Jun 13, 2005 at 10:14:05PM -0700, li nux wrote:
> My application is using remap_file_pages and mlocks
> those pages.
> So in the code of  try_to_unmap_file (see below),
> I should never reach the call to try_to_unmap_cluster,
> because for those pages VM_LOCKED is always set.
> But, under heavy load I am seeing try_to_unmap_cluster
> is getting called. Stack:

Does your app use remap_file_pages() before mlock()?

If so, the VM may be trying to reclaim pages between the call to
remap_file_pages() and the call to mlock().


-- wli

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: rmap.c: try_to_unmap_file(): VM_LOCKED not respected
  2005-06-14  5:22 ` William Lee Irwin III
@ 2005-06-14  5:48   ` li nux
  2005-06-14  6:31     ` William Lee Irwin III
  0 siblings, 1 reply; 6+ messages in thread
From: li nux @ 2005-06-14  5:48 UTC (permalink / raw)
  To: William Lee Irwin III; +Cc: linux

I first use mmap(MAP_LOCKED) and then
remap_file_pages.
This should set VM_LOCKED in the vma.

-li

--- William Lee Irwin III <wli@holomorphy.com> wrote:

> On Mon, Jun 13, 2005 at 10:14:05PM -0700, li nux
> wrote:
> > My application is using remap_file_pages and
> mlocks
> > those pages.
> > So in the code of  try_to_unmap_file (see below),
> > I should never reach the call to
> try_to_unmap_cluster,
> > because for those pages VM_LOCKED is always set.
> > But, under heavy load I am seeing
> try_to_unmap_cluster
> > is getting called. Stack:
> 
> Does your app use remap_file_pages() before mlock()?
> 
> If so, the VM may be trying to reclaim pages between
> the call to
> remap_file_pages() and the call to mlock().
> 
> 
> -- wli
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 



		
__________________________________ 
Discover Yahoo! 
Have fun online with music videos, cool games, IM and more. Check it out! 
http://discover.yahoo.com/online.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: rmap.c: try_to_unmap_file(): VM_LOCKED not respected
  2005-06-14  5:48   ` li nux
@ 2005-06-14  6:31     ` William Lee Irwin III
  2005-06-14  7:25       ` li nux
  0 siblings, 1 reply; 6+ messages in thread
From: William Lee Irwin III @ 2005-06-14  6:31 UTC (permalink / raw)
  To: li nux; +Cc: linux

On Mon, Jun 13, 2005 at 10:48:13PM -0700, li nux wrote:
> I first use mmap(MAP_LOCKED) and then
> remap_file_pages.
> This should set VM_LOCKED in the vma.

This is very odd. Could you get a backtrace with code addresses resolved
to line numbers?

When you get backtraces, it should show program counters (EIP's on i386,
RIP's on x86-64, other names on others). If you compile with debugging
symbols and keep the vmlinux, you can use addr2line to resolve them to
addresses. Hopefully this is enough for you to go on.

If you can provide this information, it would be very helpful wrt.
resolving your issue.

Thanks.


-- wli

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: rmap.c: try_to_unmap_file(): VM_LOCKED not respected
  2005-06-14  6:31     ` William Lee Irwin III
@ 2005-06-14  7:25       ` li nux
  0 siblings, 0 replies; 6+ messages in thread
From: li nux @ 2005-06-14  7:25 UTC (permalink / raw)
  To: William Lee Irwin III; +Cc: linux


--- William Lee Irwin III <wli@holomorphy.com> wrote:

> On Mon, Jun 13, 2005 at 10:48:13PM -0700, li nux
> wrote:
> > I first use mmap(MAP_LOCKED) and then
> > remap_file_pages.
> > This should set VM_LOCKED in the vma.
> 
> This is very odd. Could you get a backtrace with
> code addresses resolved
> to line numbers?
> 
> When you get backtraces, it should show program
> counters (EIP's on i386,
> RIP's on x86-64, other names on others). If you
> compile with debugging
> symbols and keep the vmlinux, you can use addr2line
> to resolve them to
> addresses. Hopefully this is enough for you to go
> on.
> 
> If you can provide this information, it would be
> very helpful wrt.
> resolving your issue.
> 
> Thanks.
> -- wli

Thanks a lot wli.
Sorry, I dont have that machine where i reproduced
this problem. Stack trace (in my first mail) is the
only info that I have with me. There is no other
application running on the system which uses
remap_file_pages (non-linear vma)

Coming to my original question. when I do
mmap(MAP_LOCKED) VM_LOCKED gets set for the vma.
who sets VM_RESERVED, does this flag has to do
anything when VM_LOCKED is already set ?

   do {
 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
                                                
shared.vm_set.list) {
     if (vma->vm_flags & (VM_LOCKED|VM_RESERVED))
              continue;
    cursor = (unsigned long) vma->vm_private_data;
while (vma->vm_mm->rss &&
cursor < max_nl_cursor &&                             
   cursor < vma->vm_end - vma->vm_start) {
                                
try_to_unmap_cluster(cursor, &mapcount, vma);
        cursor += CLUSTER_SIZE;
}
.....<snip>
   } while (max_nl_cursor <= max_nl_size);




		
__________________________________ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: rmap.c: try_to_unmap_file(): VM_LOCKED not respected
  2005-06-14  5:14 rmap.c: try_to_unmap_file(): VM_LOCKED not respected li nux
  2005-06-14  5:22 ` William Lee Irwin III
@ 2005-06-14 13:51 ` Hugh Dickins
  1 sibling, 0 replies; 6+ messages in thread
From: Hugh Dickins @ 2005-06-14 13:51 UTC (permalink / raw)
  To: li nux; +Cc: William Lee Irwin III, linux-kernel

On Mon, 13 Jun 2005, li nux wrote:
> My application is using remap_file_pages and mlocks
> those pages.
> So in the code of  try_to_unmap_file (see below),
> I should never reach the call to try_to_unmap_cluster,
> because for those pages VM_LOCKED is always set.
> But, under heavy load I am seeing try_to_unmap_cluster
> is getting called. Stack:
> try_to_unmap_cluster
> try_to_unmap_file
> try_to_unmap
> shrink_list
> 
> Any idea why VM_LOCKED is not being respected ?

Does your application fork occasionally, probably to exec something?
VM_LOCKED is masked off the flags of the child's copy vma (see dup_mmap),
so you might be seeing page reclaim hitting the child in between fork
and exec.  The parent's should remain safely VM_LOCKED as you intended.

Hugh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-14 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-14  5:14 rmap.c: try_to_unmap_file(): VM_LOCKED not respected li nux
2005-06-14  5:22 ` William Lee Irwin III
2005-06-14  5:48   ` li nux
2005-06-14  6:31     ` William Lee Irwin III
2005-06-14  7:25       ` li nux
2005-06-14 13:51 ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.