public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Chris Wright <chrisw@osdl.org>
Cc: akpm@osdl.org, chrisl@vmware.com, davej@codemonkey.org.uk,
	hpa@zytor.com, linux-kernel@vger.kernel.org, pavel@suse.cz,
	pratap@vmware.com, Riley@Williams.Name
Subject: Re: [PATCH 1/1] i386 Encapsulate copying of pgd entries
Date: Fri, 05 Aug 2005 18:52:35 -0700	[thread overview]
Message-ID: <42F417E3.2070909@vmware.com> (raw)
In-Reply-To: <20050806011301.GD7991@shell0.pdx.osdl.net>

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

  reply	other threads:[~2005-08-06  1:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-06  0:26 [PATCH 1/1] i386 Encapsulate copying of pgd entries zach
2005-08-06  1:13 ` Chris Wright
2005-08-06  1:52   ` Zachary Amsden [this message]
2005-08-06  6:00     ` Zachary Amsden
2005-08-06  8:05   ` Zachary Amsden
2005-08-07 19:00 ` Pavel Machek
2005-08-07 19:20   ` Zachary Amsden
2005-08-07 19:37     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42F417E3.2070909@vmware.com \
    --to=zach@vmware.com \
    --cc=Riley@Williams.Name \
    --cc=akpm@osdl.org \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=davej@codemonkey.org.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=pratap@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox