lkml.org 
[lkml]   [1999]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kanoj-mm17-2.3.21 kswapd vma scanning protection
Linus Torvalds wrote:
>
> .. hold a spinlock - we can probably just reuse the
> page_table_lock for this to avoid multiple levels of locking
> here..
>
> file = fget(vma->vm_file);
^^^^^^^
> offset = file->f_offset + (address - vma->vm_start);
> flush_tlb_page(vma, address);
> spin_unlock(&vma->vm_mm->page_table_lock);
>
> error = file->f_ops->swapout(file, offset, page);
> fput(file);
>
> ...
>
> and then the other requirement would be that whenever the vma chain is
> physically modified, you also have to hold the page_table_lock.
>

What about shm? vma->vm_file is NULL, this would oops.
I think that both "prepare for possible vma removal" and the parameters
which are passed to ->swapout() should be vma-specific: what about a
vm_ops->swapprepare()? This function should not allocate memory, ie
parameter passing should be stack based:

<<<<< mm.h
struct private_data
{
void* private[4];
};
struct vm_ops
{
...
void (*swapprepare)(struct vm_area_struct * vma, struct page * page,
struct private_data * info);
void (*swapout)(struct private_data * info, struct page* page);
...
};
>>>>>>>>>
<<<<<<<< vmscan.c

if(vma->vm_ops && vma->vm_ops->swapout) {
int error;
struct private_data info;
void (*swapout)(...);

pte_clear(page_table);
swapout = vma->vm_ops->swapout;
vma->vm_ops->swapprepare(vma,page,&info);
spin_unlock(page_table_lock);
flush_tlb_page();
error = swapout(&info,page);
...
}
>>>>>>>>>>>>>>>>


--
Manfred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.058 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site