Message ID | 1395730215-11604-2-git-send-email-maddy@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Tue, Mar 25, 2014 at 12:20:15PM +0530, Madhavan Srinivasan wrote: > Kirill A. Shutemov with the commit 96bacfe542 introduced > vm_ops->map_pages() for mapping easy accessible pages around > fault address in hope to reduce number of minor page faults. > Based on his workload runs, suggested FAULT_AROUND_ORDER > (knob to control the numbers of pages to map) is 4. > > This patch moves the FAULT_AROUND_ORDER macro to arch/ for > architecture maintainers to decide on suitable FAULT_AROUND_ORDER > value based on performance data for that architecture. > > Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> > --- > arch/powerpc/include/asm/pgtable.h | 6 ++++++ > arch/x86/include/asm/pgtable.h | 5 +++++ > include/asm-generic/pgtable.h | 10 ++++++++++ > mm/memory.c | 2 -- > 4 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h > index 3ebb188..9fcbd48 100644 > --- a/arch/powerpc/include/asm/pgtable.h > +++ b/arch/powerpc/include/asm/pgtable.h > @@ -19,6 +19,12 @@ struct mm_struct; > #endif > > /* > + * With a few real world workloads that were run, > + * the performance data showed that a value of 3 is more advantageous. > + */ > +#define FAULT_AROUND_ORDER 3 > + > +/* > * We save the slot number & secondary bit in the second half of the > * PTE page. We use the 8 bytes per each pte entry. > */ > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index 938ef1d..8387a65 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -7,6 +7,11 @@ > #include <asm/pgtable_types.h> > > /* > + * Based on Kirill's test results, fault around order is set to 4 > + */ > +#define FAULT_AROUND_ORDER 4 > + > +/* > * Macro to mark a page protection value as UC- > */ > #define pgprot_noncached(prot) \ > diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 1ec08c1..62f7f07 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h > @@ -7,6 +7,16 @@ > #include <linux/mm_types.h> > #include <linux/bug.h> > > + > +/* > + * Fault around order is a control knob to decide the fault around pages. > + * Default value is set to 0UL (disabled), but the arch can override it as > + * desired. > + */ > +#ifndef FAULT_AROUND_ORDER > +#define FAULT_AROUND_ORDER 0UL > +#endif FAULT_AROUND_ORDER == 0 case should be handled separately in do_read_fault(): no reason to go to do_fault_around() if we are going to fault in only one page.
On 03/25/2014 10:36 AM, Kirill A. Shutemov wrote: >> > +/* >> > + * Fault around order is a control knob to decide the fault around pages. >> > + * Default value is set to 0UL (disabled), but the arch can override it as >> > + * desired. >> > + */ >> > +#ifndef FAULT_AROUND_ORDER >> > +#define FAULT_AROUND_ORDER 0UL >> > +#endif > FAULT_AROUND_ORDER == 0 case should be handled separately in > do_read_fault(): no reason to go to do_fault_around() if we are going to > fault in only one page. Isn't this the kind of thing we want to do in Kconfig?
On Tuesday 25 March 2014 11:06 PM, Kirill A. Shutemov wrote: > On Tue, Mar 25, 2014 at 12:20:15PM +0530, Madhavan Srinivasan wrote: >> Kirill A. Shutemov with the commit 96bacfe542 introduced >> vm_ops->map_pages() for mapping easy accessible pages around >> fault address in hope to reduce number of minor page faults. >> Based on his workload runs, suggested FAULT_AROUND_ORDER >> (knob to control the numbers of pages to map) is 4. >> >> This patch moves the FAULT_AROUND_ORDER macro to arch/ for >> architecture maintainers to decide on suitable FAULT_AROUND_ORDER >> value based on performance data for that architecture. >> >> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> >> --- >> arch/powerpc/include/asm/pgtable.h | 6 ++++++ >> arch/x86/include/asm/pgtable.h | 5 +++++ >> include/asm-generic/pgtable.h | 10 ++++++++++ >> mm/memory.c | 2 -- >> 4 files changed, 21 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h >> index 3ebb188..9fcbd48 100644 >> --- a/arch/powerpc/include/asm/pgtable.h >> +++ b/arch/powerpc/include/asm/pgtable.h >> @@ -19,6 +19,12 @@ struct mm_struct; >> #endif >> >> /* >> + * With a few real world workloads that were run, >> + * the performance data showed that a value of 3 is more advantageous. >> + */ >> +#define FAULT_AROUND_ORDER 3 >> + >> +/* >> * We save the slot number & secondary bit in the second half of the >> * PTE page. We use the 8 bytes per each pte entry. >> */ >> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h >> index 938ef1d..8387a65 100644 >> --- a/arch/x86/include/asm/pgtable.h >> +++ b/arch/x86/include/asm/pgtable.h >> @@ -7,6 +7,11 @@ >> #include <asm/pgtable_types.h> >> >> /* >> + * Based on Kirill's test results, fault around order is set to 4 >> + */ >> +#define FAULT_AROUND_ORDER 4 >> + >> +/* >> * Macro to mark a page protection value as UC- >> */ >> #define pgprot_noncached(prot) \ >> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h >> index 1ec08c1..62f7f07 100644 >> --- a/include/asm-generic/pgtable.h >> +++ b/include/asm-generic/pgtable.h >> @@ -7,6 +7,16 @@ >> #include <linux/mm_types.h> >> #include <linux/bug.h> >> >> + >> +/* >> + * Fault around order is a control knob to decide the fault around pages. >> + * Default value is set to 0UL (disabled), but the arch can override it as >> + * desired. >> + */ >> +#ifndef FAULT_AROUND_ORDER >> +#define FAULT_AROUND_ORDER 0UL >> +#endif > > FAULT_AROUND_ORDER == 0 case should be handled separately in > do_read_fault(): no reason to go to do_fault_around() if we are going to > fault in only one page. > ok agreed. I am thinking of adding FAULT_AROUND_ORDER check with map_pages check in the do_read_fault. Kindly share your thoughts. With regards Maddy
On Tuesday 25 March 2014 11:20 PM, Dave Hansen wrote: > On 03/25/2014 10:36 AM, Kirill A. Shutemov wrote: >>>> +/* >>>> + * Fault around order is a control knob to decide the fault around pages. >>>> + * Default value is set to 0UL (disabled), but the arch can override it as >>>> + * desired. >>>> + */ >>>> +#ifndef FAULT_AROUND_ORDER >>>> +#define FAULT_AROUND_ORDER 0UL >>>> +#endif >> FAULT_AROUND_ORDER == 0 case should be handled separately in >> do_read_fault(): no reason to go to do_fault_around() if we are going to >> fault in only one page. > > Isn't this the kind of thing we want to do in Kconfig? > > I am still investigating this option since this looks better. But it is taking time, my bad. I will get back on this. With Regards Maddy
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 3ebb188..9fcbd48 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -19,6 +19,12 @@ struct mm_struct; #endif /* + * With a few real world workloads that were run, + * the performance data showed that a value of 3 is more advantageous. + */ +#define FAULT_AROUND_ORDER 3 + +/* * We save the slot number & secondary bit in the second half of the * PTE page. We use the 8 bytes per each pte entry. */ diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 938ef1d..8387a65 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -7,6 +7,11 @@ #include <asm/pgtable_types.h> /* + * Based on Kirill's test results, fault around order is set to 4 + */ +#define FAULT_AROUND_ORDER 4 + +/* * Macro to mark a page protection value as UC- */ #define pgprot_noncached(prot) \ diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 1ec08c1..62f7f07 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -7,6 +7,16 @@ #include <linux/mm_types.h> #include <linux/bug.h> + +/* + * Fault around order is a control knob to decide the fault around pages. + * Default value is set to 0UL (disabled), but the arch can override it as + * desired. + */ +#ifndef FAULT_AROUND_ORDER +#define FAULT_AROUND_ORDER 0UL +#endif + /* * On almost all architectures and configurations, 0 can be used as the * upper ceiling to free_pgtables(): on many architectures it has the same diff --git a/mm/memory.c b/mm/memory.c index b02c584..fd79ffc 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3358,8 +3358,6 @@ void do_set_pte(struct vm_area_struct *vma, unsigned long address, update_mmu_cache(vma, address, pte); } -#define FAULT_AROUND_ORDER 4 - #ifdef CONFIG_DEBUG_FS static unsigned int fault_around_order = FAULT_AROUND_ORDER;
Kirill A. Shutemov with the commit 96bacfe542 introduced vm_ops->map_pages() for mapping easy accessible pages around fault address in hope to reduce number of minor page faults. Based on his workload runs, suggested FAULT_AROUND_ORDER (knob to control the numbers of pages to map) is 4. This patch moves the FAULT_AROUND_ORDER macro to arch/ for architecture maintainers to decide on suitable FAULT_AROUND_ORDER value based on performance data for that architecture. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> --- arch/powerpc/include/asm/pgtable.h | 6 ++++++ arch/x86/include/asm/pgtable.h | 5 +++++ include/asm-generic/pgtable.h | 10 ++++++++++ mm/memory.c | 2 -- 4 files changed, 21 insertions(+), 2 deletions(-)