Re: missing madvise functionality

Eric Dumazet
2007-04-04T05:42:32Z

Nick Piggin a écrit :
> Eric Dumazet wrote:
>>
>> I do think such workloads might benefit from a vma_cache not shared by
>> all threads but private to each thread. A sequence could invalidate
>> the cache(s).
>>
>> ie instead of a mm->mmap_cache, having a mm->sequence, and each thread
>> having a current->mmap_cache and current->mm_sequence
>
> I have a patchset to do exactly this, btw.

Could you repost it please ?

I guess a seqlock could avoid some cache line bouncing on mmap_sem for some
kind of operations. I wonder if it could speed up do_page_fault() ???

>
> Anyway what is the status of the private futex work. I don't think that
> is very intrusive or complicated, so it should get merged ASAP (so then
> at least we have the interface there).
>

It seems nobody but you and me cared.

BTW I am surprised of Ulrich bugging linux on MADV_KERNEL_CAN_DROP, while
glibc still does :

FILE *F = fopen("/etc/passwd", "r");
fget(line, sizeof(line), F);
fclose(F);

->

open("/etc/passwd", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1505, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2b67097f0000
read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1505
close(3) = 0
munmap(0x2b67097f0000, 4096) = 0

using mmap()/munmap() to allocate one 4096 bytes area is certainly overkill.
mmap_sem is apparently the thing we must hit forever.

Maybe nobody but me still uses fopen()/fclose() after all ?