lkml.org 
[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 05/16] KVM: MMU: abstract spte write-protect
On Fri, 13 Apr 2012 18:11:45 +0800
Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> wrote:

> +/* Return true if the spte is dropped. */

Return value does not correspond with the function name so it is confusing.

People may think that true means write protection has been done.

> +static bool spte_write_protect(struct kvm *kvm, u64 *sptep, bool large,
> + bool *flush)
> +{
> + u64 spte = *sptep;
> +
> + if (!is_writable_pte(spte))
> + return false;
> +
> + *flush |= true;
> +
> + if (large) {
> + pgprintk("rmap_write_protect(large): spte %p %llx\n",
> + spte, *spte);
> + BUG_ON(!is_large_pte(spte));
> +
> + drop_spte(kvm, sptep);
> + --kvm->stat.lpages;
> + return true;
> + }

This suggests we should use separate functions?

Takuya


\
 
 \ /
  Last update: 2012-04-14 04:29    [W:0.260 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site