Re: [PATCH v7 09/12] s390/mm: Add huge pmd storage key handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -835,20 +859,40 @@ EXPORT_SYMBOL(cond_set_guest_storage_key);
>  int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
>  {
>  	spinlock_t *ptl;
> +	unsigned long paddr;
>  	pgste_t old, new;
> +	pmd_t *pmdp;
>  	pte_t *ptep;
>  	int cc = 0;
>  
> -	ptep = get_locked_pte(mm, addr, &ptl);
> -	if (unlikely(!ptep))
> +	pmdp = (pmd_t *)huge_pte_offset(mm, addr, HPAGE_SIZE);
> +	if (!pmdp)
>  		return -EFAULT;
>  
> +	ptl = pmd_lock(mm, pmdp);
> +	if (!pmd_present(*pmdp)) {
> +		spin_unlock(ptl);
> +		return -EFAULT;
> +	}
> +	if (pmd_large(*pmdp)) {
> +		paddr = pmd_val(*pmdp) & HPAGE_MASK;
> +		paddr |= addr & ~HPAGE_MASK;
> +		cc = page_reset_referenced(paddr);
> +		spin_unlock(ptl);
> +		return cc;
> +	}
> +	spin_unlock(ptl);
> +
> +	ptep = pte_alloc_map_lock(mm, pmdp, addr, &ptl);
> +	if (unlikely(!ptep))
> +		return -EFAULT;

NIT: I would add an empty line here just like for the other cases.

>  	new = old = pgste_get_lock(ptep);
>  	/* Reset guest reference bit only */
>  	pgste_val(new) &= ~PGSTE_GR_BIT;
>  

Nothing jumped at me. Some helper like get_locked_pmd() might be nice
and reduce the code size a bit. As get_locked_pte() is common code,
maybe some function local to this file?

Anyhow,

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>


-- 

Thanks,

David / dhildenb



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux