lkml.org 
[lkml]   [2005]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] i386 Encapsulate copying of pgd entries
Chris Wright wrote:

>* zach@vmware.com (zach@vmware.com) wrote:
>
>
>>+ memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
>> if (PTRS_PER_PMD == 1)
>> spin_lock_irqsave(&pgd_lock, flags);
>>
>>- memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD,
>>+ clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
>> swapper_pg_dir + USER_PTRS_PER_PGD,
>>- (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
>>-
>>+ KERNEL_PGD_PTRS);
>> if (PTRS_PER_PMD > 1)
>> return;
>>
>> pgd_list_add(pgd);
>> spin_unlock_irqrestore(&pgd_lock, flags);
>>- memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
>>
>>
>
>Why memset was never done on PAE?
>
>

That's a good point. The memset() is redundant on PAE, since it
allocates all 4 PMDs immediately after that (in pgd_alloc). There are
two reasons for moving the memset() - one is that it can potentially
perform useful work ahead of the lock and effectively act as a
prefetch. The second is that at least on a hypervisor,
clone_pgd_range() is likely to be taken as a page allocation hint, and
thus moving the memset() before this operation allows only the actually
present page directory entry updates to be passed to the hypervisor.

Actually, the memset() could be redundant on non-PAE as well, since we
should have gone through free_pgtables, which would have done a
pmd_clear() on each user level pmd, and the kernel level pmds are copied
in again inside the lock.

I'll try it out to see if this is possible.

Zach
-
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/

\
 
 \ /
  Last update: 2005-08-06 04:00    [W:0.062 / U:1.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site