* [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c @ 2016-04-20 18:24 Yang Shi 2016-04-20 19:04 ` kbuild test robot ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Yang Shi @ 2016-04-20 18:24 UTC (permalink / raw) To: akpm, kirill.shutemov, aarcange, hughd, mgorman Cc: linux-kernel, linux-mm, linaro-kernel, yang.shi huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, move the definition to memory.c and make it static like create_huge_pmd and wp_huge_pmd. Signed-off-by: Yang Shi <yang.shi@linaro.org> --- include/linux/huge_mm.h | 4 ---- mm/huge_memory.c | 23 ----------------------- mm/memory.c | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 7008623..c218ab7b 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -8,10 +8,6 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct *mm, extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, struct vm_area_struct *vma); -extern void huge_pmd_set_accessed(struct mm_struct *mm, - struct vm_area_struct *vma, - unsigned long address, pmd_t *pmd, - pmd_t orig_pmd, int dirty); extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pmd_t orig_pmd); diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fecbbc5..6c14cb6 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1137,29 +1137,6 @@ out: return ret; } -void huge_pmd_set_accessed(struct mm_struct *mm, - struct vm_area_struct *vma, - unsigned long address, - pmd_t *pmd, pmd_t orig_pmd, - int dirty) -{ - spinlock_t *ptl; - pmd_t entry; - unsigned long haddr; - - ptl = pmd_lock(mm, pmd); - if (unlikely(!pmd_same(*pmd, orig_pmd))) - goto unlock; - - entry = pmd_mkyoung(orig_pmd); - haddr = address & HPAGE_PMD_MASK; - if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) - update_mmu_cache_pmd(vma, address, pmd); - -unlock: - spin_unlock(ptl); -} - static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, diff --git a/mm/memory.c b/mm/memory.c index 93897f2..6ced4eb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3287,6 +3287,29 @@ static int wp_huge_pmd(struct mm_struct *mm, struct vm_area_struct *vma, return VM_FAULT_FALLBACK; } +static void huge_pmd_set_accessed(struct mm_struct *mm, + struct vm_area_struct *vma, + unsigned long address, + pmd_t *pmd, pmd_t orig_pmd, + int dirty) +{ + spinlock_t *ptl; + pmd_t entry; + unsigned long haddr; + + ptl = pmd_lock(mm, pmd); + if (unlikely(!pmd_same(*pmd, orig_pmd))) + goto unlock; + + entry = pmd_mkyoung(orig_pmd); + haddr = address & HPAGE_PMD_MASK; + if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) + update_mmu_cache_pmd(vma, address, pmd); + +unlock: + spin_unlock(ptl); +} + /* * These routines also need to handle stuff like marking pages dirty * and/or accessed for architectures that don't do it in hardware (most -- 2.0.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 18:24 [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Yang Shi @ 2016-04-20 19:04 ` kbuild test robot 2016-04-20 19:09 ` kbuild test robot ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: kbuild test robot @ 2016-04-20 19:04 UTC (permalink / raw) To: Yang Shi Cc: kbuild-all, akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel [-- Attachment #1: Type: text/plain, Size: 1629 bytes --] Hi, [auto build test ERROR on v4.6-rc4] [also build test ERROR on next-20160420] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Yang-Shi/mm-move-huge_pmd_set_accessed-out-of-huge_memory-c/20160421-025318 config: mips-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=mips All errors (new ones prefixed by >>): mm/memory.c: In function 'huge_pmd_set_accessed': >> mm/memory.c:3304:10: error: implicit declaration of function 'pmd_mkyoung' [-Werror=implicit-function-declaration] entry = pmd_mkyoung(orig_pmd); ^ >> mm/memory.c:3304:8: error: incompatible types when assigning to type 'pmd_t {aka struct <anonymous>}' from type 'int' entry = pmd_mkyoung(orig_pmd); ^ cc1: some warnings being treated as errors vim +/pmd_mkyoung +3304 mm/memory.c 3298 unsigned long haddr; 3299 3300 ptl = pmd_lock(mm, pmd); 3301 if (unlikely(!pmd_same(*pmd, orig_pmd))) 3302 goto unlock; 3303 > 3304 entry = pmd_mkyoung(orig_pmd); 3305 haddr = address & HPAGE_PMD_MASK; 3306 if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) 3307 update_mmu_cache_pmd(vma, address, pmd); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 41426 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 18:24 [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Yang Shi 2016-04-20 19:04 ` kbuild test robot @ 2016-04-20 19:09 ` kbuild test robot 2016-04-20 19:20 ` kbuild test robot 2016-04-20 21:00 ` Shi, Yang 3 siblings, 0 replies; 11+ messages in thread From: kbuild test robot @ 2016-04-20 19:09 UTC (permalink / raw) To: Yang Shi Cc: kbuild-all, akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel [-- Attachment #1: Type: text/plain, Size: 1465 bytes --] Hi, [auto build test ERROR on v4.6-rc4] [also build test ERROR on next-20160420] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Yang-Shi/mm-move-huge_pmd_set_accessed-out-of-huge_memory-c/20160421-025318 config: powerpc-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=powerpc All errors (new ones prefixed by >>): mm/memory.c: In function 'huge_pmd_set_accessed': >> mm/memory.c:3307:3: error: implicit declaration of function 'update_mmu_cache_pmd' [-Werror=implicit-function-declaration] update_mmu_cache_pmd(vma, address, pmd); ^ cc1: some warnings being treated as errors vim +/update_mmu_cache_pmd +3307 mm/memory.c 3301 if (unlikely(!pmd_same(*pmd, orig_pmd))) 3302 goto unlock; 3303 3304 entry = pmd_mkyoung(orig_pmd); 3305 haddr = address & HPAGE_PMD_MASK; 3306 if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) > 3307 update_mmu_cache_pmd(vma, address, pmd); 3308 3309 unlock: 3310 spin_unlock(ptl); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 48660 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 18:24 [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Yang Shi 2016-04-20 19:04 ` kbuild test robot 2016-04-20 19:09 ` kbuild test robot @ 2016-04-20 19:20 ` kbuild test robot 2016-04-20 21:00 ` Shi, Yang 3 siblings, 0 replies; 11+ messages in thread From: kbuild test robot @ 2016-04-20 19:20 UTC (permalink / raw) To: Yang Shi Cc: kbuild-all, akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel [-- Attachment #1: Type: text/plain, Size: 1458 bytes --] Hi, [auto build test ERROR on v4.6-rc4] [also build test ERROR on next-20160420] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Yang-Shi/mm-move-huge_pmd_set_accessed-out-of-huge_memory-c/20160421-025318 config: avr32-atngw100_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=avr32 All errors (new ones prefixed by >>): mm/memory.c: In function 'huge_pmd_set_accessed': mm/memory.c:3304: error: implicit declaration of function 'pmd_mkyoung' >> mm/memory.c:3304: error: incompatible types in assignment mm/memory.c:3307: error: implicit declaration of function 'update_mmu_cache_pmd' vim +3304 mm/memory.c 3298 unsigned long haddr; 3299 3300 ptl = pmd_lock(mm, pmd); 3301 if (unlikely(!pmd_same(*pmd, orig_pmd))) 3302 goto unlock; 3303 > 3304 entry = pmd_mkyoung(orig_pmd); 3305 haddr = address & HPAGE_PMD_MASK; 3306 if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) 3307 update_mmu_cache_pmd(vma, address, pmd); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 12362 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 18:24 [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Yang Shi ` (2 preceding siblings ...) 2016-04-20 19:20 ` kbuild test robot @ 2016-04-20 21:00 ` Shi, Yang 2016-04-21 7:30 ` Kirill A. Shutemov 2016-04-21 9:15 ` Hugh Dickins 3 siblings, 2 replies; 11+ messages in thread From: Shi, Yang @ 2016-04-20 21:00 UTC (permalink / raw) To: akpm, kirill.shutemov, aarcange, hughd, mgorman Cc: linux-kernel, linux-mm, linaro-kernel Hi folks, I didn't realize pmd_* functions are protected by CONFIG_TRANSPARENT_HUGEPAGE on the most architectures before I made this change. Before I fix all the affected architectures code, I want to check if you guys think this change is worth or not? Thanks, Yang On 4/20/2016 11:24 AM, Yang Shi wrote: > huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, > move the definition to memory.c and make it static like create_huge_pmd and > wp_huge_pmd. > > Signed-off-by: Yang Shi <yang.shi@linaro.org> > --- > include/linux/huge_mm.h | 4 ---- > mm/huge_memory.c | 23 ----------------------- > mm/memory.c | 23 +++++++++++++++++++++++ > 3 files changed, 23 insertions(+), 27 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 7008623..c218ab7b 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -8,10 +8,6 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct *mm, > extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, > pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, > struct vm_area_struct *vma); > -extern void huge_pmd_set_accessed(struct mm_struct *mm, > - struct vm_area_struct *vma, > - unsigned long address, pmd_t *pmd, > - pmd_t orig_pmd, int dirty); > extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, > unsigned long address, pmd_t *pmd, > pmd_t orig_pmd); > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index fecbbc5..6c14cb6 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1137,29 +1137,6 @@ out: > return ret; > } > > -void huge_pmd_set_accessed(struct mm_struct *mm, > - struct vm_area_struct *vma, > - unsigned long address, > - pmd_t *pmd, pmd_t orig_pmd, > - int dirty) > -{ > - spinlock_t *ptl; > - pmd_t entry; > - unsigned long haddr; > - > - ptl = pmd_lock(mm, pmd); > - if (unlikely(!pmd_same(*pmd, orig_pmd))) > - goto unlock; > - > - entry = pmd_mkyoung(orig_pmd); > - haddr = address & HPAGE_PMD_MASK; > - if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) > - update_mmu_cache_pmd(vma, address, pmd); > - > -unlock: > - spin_unlock(ptl); > -} > - > static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, > struct vm_area_struct *vma, > unsigned long address, > diff --git a/mm/memory.c b/mm/memory.c > index 93897f2..6ced4eb 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3287,6 +3287,29 @@ static int wp_huge_pmd(struct mm_struct *mm, struct vm_area_struct *vma, > return VM_FAULT_FALLBACK; > } > > +static void huge_pmd_set_accessed(struct mm_struct *mm, > + struct vm_area_struct *vma, > + unsigned long address, > + pmd_t *pmd, pmd_t orig_pmd, > + int dirty) > +{ > + spinlock_t *ptl; > + pmd_t entry; > + unsigned long haddr; > + > + ptl = pmd_lock(mm, pmd); > + if (unlikely(!pmd_same(*pmd, orig_pmd))) > + goto unlock; > + > + entry = pmd_mkyoung(orig_pmd); > + haddr = address & HPAGE_PMD_MASK; > + if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) > + update_mmu_cache_pmd(vma, address, pmd); > + > +unlock: > + spin_unlock(ptl); > +} > + > /* > * These routines also need to handle stuff like marking pages dirty > * and/or accessed for architectures that don't do it in hardware (most > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 21:00 ` Shi, Yang @ 2016-04-21 7:30 ` Kirill A. Shutemov 2016-04-21 22:56 ` Shi, Yang 2016-04-21 9:15 ` Hugh Dickins 1 sibling, 1 reply; 11+ messages in thread From: Kirill A. Shutemov @ 2016-04-21 7:30 UTC (permalink / raw) To: Shi, Yang Cc: akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel On Wed, Apr 20, 2016 at 02:00:11PM -0700, Shi, Yang wrote: > Hi folks, > > I didn't realize pmd_* functions are protected by > CONFIG_TRANSPARENT_HUGEPAGE on the most architectures before I made this > change. > > Before I fix all the affected architectures code, I want to check if you > guys think this change is worth or not? > > Thanks, > Yang > > On 4/20/2016 11:24 AM, Yang Shi wrote: > >huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, > >move the definition to memory.c and make it static like create_huge_pmd and > >wp_huge_pmd. > > > >Signed-off-by: Yang Shi <yang.shi@linaro.org> On pte side we have the same functionality open-coded. Should we do the same for pmd? Or change pte side the same way? -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-21 7:30 ` Kirill A. Shutemov @ 2016-04-21 22:56 ` Shi, Yang 2016-04-22 9:48 ` Kirill A. Shutemov 0 siblings, 1 reply; 11+ messages in thread From: Shi, Yang @ 2016-04-21 22:56 UTC (permalink / raw) To: Kirill A. Shutemov Cc: akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel On 4/21/2016 12:30 AM, Kirill A. Shutemov wrote: > On Wed, Apr 20, 2016 at 02:00:11PM -0700, Shi, Yang wrote: >> Hi folks, >> >> I didn't realize pmd_* functions are protected by >> CONFIG_TRANSPARENT_HUGEPAGE on the most architectures before I made this >> change. >> >> Before I fix all the affected architectures code, I want to check if you >> guys think this change is worth or not? >> >> Thanks, >> Yang >> >> On 4/20/2016 11:24 AM, Yang Shi wrote: >>> huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, >>> move the definition to memory.c and make it static like create_huge_pmd and >>> wp_huge_pmd. >>> >>> Signed-off-by: Yang Shi <yang.shi@linaro.org> > > On pte side we have the same functionality open-coded. Should we do the > same for pmd? Or change pte side the same way? Sorry, I don't quite understand you. Do you mean pte_* functions? Thanks, Yang > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-21 22:56 ` Shi, Yang @ 2016-04-22 9:48 ` Kirill A. Shutemov 2016-04-29 18:09 ` Shi, Yang 0 siblings, 1 reply; 11+ messages in thread From: Kirill A. Shutemov @ 2016-04-22 9:48 UTC (permalink / raw) To: Shi, Yang Cc: akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel On Thu, Apr 21, 2016 at 03:56:07PM -0700, Shi, Yang wrote: > On 4/21/2016 12:30 AM, Kirill A. Shutemov wrote: > >On Wed, Apr 20, 2016 at 02:00:11PM -0700, Shi, Yang wrote: > >>Hi folks, > >> > >>I didn't realize pmd_* functions are protected by > >>CONFIG_TRANSPARENT_HUGEPAGE on the most architectures before I made this > >>change. > >> > >>Before I fix all the affected architectures code, I want to check if you > >>guys think this change is worth or not? > >> > >>Thanks, > >>Yang > >> > >>On 4/20/2016 11:24 AM, Yang Shi wrote: > >>>huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, > >>>move the definition to memory.c and make it static like create_huge_pmd and > >>>wp_huge_pmd. > >>> > >>>Signed-off-by: Yang Shi <yang.shi@linaro.org> > > > >On pte side we have the same functionality open-coded. Should we do the > >same for pmd? Or change pte side the same way? > > Sorry, I don't quite understand you. Do you mean pte_* functions? See handle_pte_fault(), we do the same for pte there what huge_pmd_set_accessed() does for pmd. I think we should be consistent here: either both are abstructed into functions or both open-coded. -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-22 9:48 ` Kirill A. Shutemov @ 2016-04-29 18:09 ` Shi, Yang 0 siblings, 0 replies; 11+ messages in thread From: Shi, Yang @ 2016-04-29 18:09 UTC (permalink / raw) To: Kirill A. Shutemov Cc: akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel On 4/22/2016 2:48 AM, Kirill A. Shutemov wrote: > On Thu, Apr 21, 2016 at 03:56:07PM -0700, Shi, Yang wrote: >> On 4/21/2016 12:30 AM, Kirill A. Shutemov wrote: >>> On Wed, Apr 20, 2016 at 02:00:11PM -0700, Shi, Yang wrote: >>>> Hi folks, >>>> >>>> I didn't realize pmd_* functions are protected by >>>> CONFIG_TRANSPARENT_HUGEPAGE on the most architectures before I made this >>>> change. >>>> >>>> Before I fix all the affected architectures code, I want to check if you >>>> guys think this change is worth or not? >>>> >>>> Thanks, >>>> Yang >>>> >>>> On 4/20/2016 11:24 AM, Yang Shi wrote: >>>>> huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, >>>>> move the definition to memory.c and make it static like create_huge_pmd and >>>>> wp_huge_pmd. >>>>> >>>>> Signed-off-by: Yang Shi <yang.shi@linaro.org> >>> >>> On pte side we have the same functionality open-coded. Should we do the >>> same for pmd? Or change pte side the same way? >> >> Sorry, I don't quite understand you. Do you mean pte_* functions? > > See handle_pte_fault(), we do the same for pte there what > huge_pmd_set_accessed() does for pmd. Thanks for directing to this code. > > I think we should be consistent here: either both are abstructed into > functions or both open-coded. I'm supposed functions sound better. However, do_wp_page has to be called with pte lock acquired. So, the abstracted function has to call it. Thanks, Yang > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-20 21:00 ` Shi, Yang 2016-04-21 7:30 ` Kirill A. Shutemov @ 2016-04-21 9:15 ` Hugh Dickins 2016-04-21 22:57 ` Shi, Yang 1 sibling, 1 reply; 11+ messages in thread From: Hugh Dickins @ 2016-04-21 9:15 UTC (permalink / raw) To: Shi, Yang Cc: akpm, kirill.shutemov, aarcange, hughd, mgorman, linux-kernel, linux-mm, linaro-kernel On Wed, 20 Apr 2016, Shi, Yang wrote: > Hi folks, > > I didn't realize pmd_* functions are protected by CONFIG_TRANSPARENT_HUGEPAGE > on the most architectures before I made this change. > > Before I fix all the affected architectures code, I want to check if you guys > think this change is worth or not? Thanks for asking: no, it is not worthwhile. I would much prefer not to have to consider these trivial cleanups in the huge memory area at this time. Kirill and I have urgent work to do in this area, and coping with patch conflicts between different versions of the source will not help any of us. Thanks, Hugh > > Thanks, > Yang > > On 4/20/2016 11:24 AM, Yang Shi wrote: > > huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, > > move the definition to memory.c and make it static like create_huge_pmd and > > wp_huge_pmd. > > > > Signed-off-by: Yang Shi <yang.shi@linaro.org> > > --- > > include/linux/huge_mm.h | 4 ---- > > mm/huge_memory.c | 23 ----------------------- > > mm/memory.c | 23 +++++++++++++++++++++++ > > 3 files changed, 23 insertions(+), 27 deletions(-) > > > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > > index 7008623..c218ab7b 100644 > > --- a/include/linux/huge_mm.h > > +++ b/include/linux/huge_mm.h > > @@ -8,10 +8,6 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct > > *mm, > > extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct > > *src_mm, > > pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, > > struct vm_area_struct *vma); > > -extern void huge_pmd_set_accessed(struct mm_struct *mm, > > - struct vm_area_struct *vma, > > - unsigned long address, pmd_t *pmd, > > - pmd_t orig_pmd, int dirty); > > extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct > > vm_area_struct *vma, > > unsigned long address, pmd_t *pmd, > > pmd_t orig_pmd); > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index fecbbc5..6c14cb6 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -1137,29 +1137,6 @@ out: > > return ret; > > } > > > > -void huge_pmd_set_accessed(struct mm_struct *mm, > > - struct vm_area_struct *vma, > > - unsigned long address, > > - pmd_t *pmd, pmd_t orig_pmd, > > - int dirty) > > -{ > > - spinlock_t *ptl; > > - pmd_t entry; > > - unsigned long haddr; > > - > > - ptl = pmd_lock(mm, pmd); > > - if (unlikely(!pmd_same(*pmd, orig_pmd))) > > - goto unlock; > > - > > - entry = pmd_mkyoung(orig_pmd); > > - haddr = address & HPAGE_PMD_MASK; > > - if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) > > - update_mmu_cache_pmd(vma, address, pmd); > > - > > -unlock: > > - spin_unlock(ptl); > > -} > > - > > static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, > > struct vm_area_struct *vma, > > unsigned long address, > > diff --git a/mm/memory.c b/mm/memory.c > > index 93897f2..6ced4eb 100644 > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@ -3287,6 +3287,29 @@ static int wp_huge_pmd(struct mm_struct *mm, struct > > vm_area_struct *vma, > > return VM_FAULT_FALLBACK; > > } > > > > +static void huge_pmd_set_accessed(struct mm_struct *mm, > > + struct vm_area_struct *vma, > > + unsigned long address, > > + pmd_t *pmd, pmd_t orig_pmd, > > + int dirty) > > +{ > > + spinlock_t *ptl; > > + pmd_t entry; > > + unsigned long haddr; > > + > > + ptl = pmd_lock(mm, pmd); > > + if (unlikely(!pmd_same(*pmd, orig_pmd))) > > + goto unlock; > > + > > + entry = pmd_mkyoung(orig_pmd); > > + haddr = address & HPAGE_PMD_MASK; > > + if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) > > + update_mmu_cache_pmd(vma, address, pmd); > > + > > +unlock: > > + spin_unlock(ptl); > > +} > > + > > /* > > * These routines also need to handle stuff like marking pages dirty > > * and/or accessed for architectures that don't do it in hardware (most -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c 2016-04-21 9:15 ` Hugh Dickins @ 2016-04-21 22:57 ` Shi, Yang 0 siblings, 0 replies; 11+ messages in thread From: Shi, Yang @ 2016-04-21 22:57 UTC (permalink / raw) To: Hugh Dickins Cc: akpm, kirill.shutemov, aarcange, mgorman, linux-kernel, linux-mm, linaro-kernel On 4/21/2016 2:15 AM, Hugh Dickins wrote: > On Wed, 20 Apr 2016, Shi, Yang wrote: > >> Hi folks, >> >> I didn't realize pmd_* functions are protected by CONFIG_TRANSPARENT_HUGEPAGE >> on the most architectures before I made this change. >> >> Before I fix all the affected architectures code, I want to check if you guys >> think this change is worth or not? > > Thanks for asking: no, it is not worthwhile. > > I would much prefer not to have to consider these trivial cleanups > in the huge memory area at this time. Kirill and I have urgent work > to do in this area, and coping with patch conflicts between different > versions of the source will not help any of us. Thanks for your suggestion. I would consider to put such cleanup work on the back burner. Yang > > Thanks, > Hugh > >> >> Thanks, >> Yang >> >> On 4/20/2016 11:24 AM, Yang Shi wrote: >>> huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, >>> move the definition to memory.c and make it static like create_huge_pmd and >>> wp_huge_pmd. >>> >>> Signed-off-by: Yang Shi <yang.shi@linaro.org> >>> --- >>> include/linux/huge_mm.h | 4 ---- >>> mm/huge_memory.c | 23 ----------------------- >>> mm/memory.c | 23 +++++++++++++++++++++++ >>> 3 files changed, 23 insertions(+), 27 deletions(-) >>> >>> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h >>> index 7008623..c218ab7b 100644 >>> --- a/include/linux/huge_mm.h >>> +++ b/include/linux/huge_mm.h >>> @@ -8,10 +8,6 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct >>> *mm, >>> extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct >>> *src_mm, >>> pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, >>> struct vm_area_struct *vma); >>> -extern void huge_pmd_set_accessed(struct mm_struct *mm, >>> - struct vm_area_struct *vma, >>> - unsigned long address, pmd_t *pmd, >>> - pmd_t orig_pmd, int dirty); >>> extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct >>> vm_area_struct *vma, >>> unsigned long address, pmd_t *pmd, >>> pmd_t orig_pmd); >>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>> index fecbbc5..6c14cb6 100644 >>> --- a/mm/huge_memory.c >>> +++ b/mm/huge_memory.c >>> @@ -1137,29 +1137,6 @@ out: >>> return ret; >>> } >>> >>> -void huge_pmd_set_accessed(struct mm_struct *mm, >>> - struct vm_area_struct *vma, >>> - unsigned long address, >>> - pmd_t *pmd, pmd_t orig_pmd, >>> - int dirty) >>> -{ >>> - spinlock_t *ptl; >>> - pmd_t entry; >>> - unsigned long haddr; >>> - >>> - ptl = pmd_lock(mm, pmd); >>> - if (unlikely(!pmd_same(*pmd, orig_pmd))) >>> - goto unlock; >>> - >>> - entry = pmd_mkyoung(orig_pmd); >>> - haddr = address & HPAGE_PMD_MASK; >>> - if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) >>> - update_mmu_cache_pmd(vma, address, pmd); >>> - >>> -unlock: >>> - spin_unlock(ptl); >>> -} >>> - >>> static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, >>> struct vm_area_struct *vma, >>> unsigned long address, >>> diff --git a/mm/memory.c b/mm/memory.c >>> index 93897f2..6ced4eb 100644 >>> --- a/mm/memory.c >>> +++ b/mm/memory.c >>> @@ -3287,6 +3287,29 @@ static int wp_huge_pmd(struct mm_struct *mm, struct >>> vm_area_struct *vma, >>> return VM_FAULT_FALLBACK; >>> } >>> >>> +static void huge_pmd_set_accessed(struct mm_struct *mm, >>> + struct vm_area_struct *vma, >>> + unsigned long address, >>> + pmd_t *pmd, pmd_t orig_pmd, >>> + int dirty) >>> +{ >>> + spinlock_t *ptl; >>> + pmd_t entry; >>> + unsigned long haddr; >>> + >>> + ptl = pmd_lock(mm, pmd); >>> + if (unlikely(!pmd_same(*pmd, orig_pmd))) >>> + goto unlock; >>> + >>> + entry = pmd_mkyoung(orig_pmd); >>> + haddr = address & HPAGE_PMD_MASK; >>> + if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) >>> + update_mmu_cache_pmd(vma, address, pmd); >>> + >>> +unlock: >>> + spin_unlock(ptl); >>> +} >>> + >>> /* >>> * These routines also need to handle stuff like marking pages dirty >>> * and/or accessed for architectures that don't do it in hardware (most -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-04-29 18:09 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-04-20 18:24 [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Yang Shi 2016-04-20 19:04 ` kbuild test robot 2016-04-20 19:09 ` kbuild test robot 2016-04-20 19:20 ` kbuild test robot 2016-04-20 21:00 ` Shi, Yang 2016-04-21 7:30 ` Kirill A. Shutemov 2016-04-21 22:56 ` Shi, Yang 2016-04-22 9:48 ` Kirill A. Shutemov 2016-04-29 18:09 ` Shi, Yang 2016-04-21 9:15 ` Hugh Dickins 2016-04-21 22:57 ` Shi, Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).