Re: [PATCH] mm/swapfile: fix swapoff vs. software dirty bits

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

 



On Fri, 18 Sep 2015 11:53:01 +0300
Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:

> On Fri, Sep 18, 2015 at 10:20:01AM +0200, Martin Schwidefsky wrote:
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index e2d46ad..b029d42 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -754,7 +754,7 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma,
> >  
> >  	if (pte_present(ptent)) {
> >  		ptent = pte_wrprotect(ptent);
> > -		ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY);
> > +		ptent = pte_clear_soft_dirty(ptent);
> >  	} else if (is_swap_pte(ptent)) {
> >  		ptent = pte_swp_clear_soft_dirty(ptent);
> >  	}
> > @@ -768,7 +768,7 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
> >  	pmd_t pmd = *pmdp;
> >  
> >  	pmd = pmd_wrprotect(pmd);
> > -	pmd = pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY);
> > +	pmd = pmd_clear_soft_dirty(pmd);
> >  
> 
> You know, these are only two lines where we use _PAGE_SOFT_DIRTY
> directly, so I don't see much point in adding 22 lines of code
> for that. Maybe we can leave it as is?
 
Only x86 has pte_clear_flags. And the two lines require that there is exactly
one bit in the PTE for soft-dirty. An alternative encoding will not be allowed.
And the current set of primitives is asymmetric, there are functions to query
and set the bit pte_soft_dirty and pte_mksoft_dirty but no function to clear
the bit.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]