Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Yang, Bin
On Fri, 2018-09-07 at 10:21 +0200, Thomas Gleixner wrote: > On Fri, 7 Sep 2018, Yang, Bin wrote: > > On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > > > On Fri, 7 Sep 2018, Yang, Bin wrote: > > > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > > > > > I just write

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Yang, Bin
On Fri, 2018-09-07 at 10:21 +0200, Thomas Gleixner wrote: > On Fri, 7 Sep 2018, Yang, Bin wrote: > > On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > > > On Fri, 7 Sep 2018, Yang, Bin wrote: > > > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > > > > > I just write

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Thomas Gleixner
On Fri, 7 Sep 2018, Yang, Bin wrote: > On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > > On Fri, 7 Sep 2018, Yang, Bin wrote: > > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > > > I just write a test.c to compare the result between overlap() and > > > original

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Thomas Gleixner
On Fri, 7 Sep 2018, Yang, Bin wrote: > On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > > On Fri, 7 Sep 2018, Yang, Bin wrote: > > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > > > I just write a test.c to compare the result between overlap() and > > > original

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Yang, Bin
On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > On Fri, 7 Sep 2018, Yang, Bin wrote: > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > I just write a test.c to compare the result between overlap() and > > original within(). > > You are right. Your version of doing

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Yang, Bin
On Fri, 2018-09-07 at 09:49 +0200, Thomas Gleixner wrote: > On Fri, 7 Sep 2018, Yang, Bin wrote: > > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > > > I just write a test.c to compare the result between overlap() and > > original within(). > > You are right. Your version of doing

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Thomas Gleixner
On Fri, 7 Sep 2018, Yang, Bin wrote: > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > I just write a test.c to compare the result between overlap() and > original within(). You are right. Your version of doing the overlap exclusive works. I misread the conditions. I still prefer

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-07 Thread Thomas Gleixner
On Fri, 7 Sep 2018, Yang, Bin wrote: > On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > > I just write a test.c to compare the result between overlap() and > original within(). You are right. Your version of doing the overlap exclusive works. I misread the conditions. I still prefer

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-06 Thread Yang, Bin
On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > On Tue, 21 Aug 2018, Bin Yang wrote: > > > > +static inline bool > > +overlap(unsigned long start1, unsigned long end1, > > + unsigned long start2, unsigned long end2) > > +{ > > + /* Is 'start2' within area 1? */ > > + if

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-06 Thread Yang, Bin
On Tue, 2018-09-04 at 14:22 +0200, Thomas Gleixner wrote: > On Tue, 21 Aug 2018, Bin Yang wrote: > > > > +static inline bool > > +overlap(unsigned long start1, unsigned long end1, > > + unsigned long start2, unsigned long end2) > > +{ > > + /* Is 'start2' within area 1? */ > > + if

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-04 Thread Thomas Gleixner
On Tue, 21 Aug 2018, Bin Yang wrote: > > +static inline bool > +overlap(unsigned long start1, unsigned long end1, > + unsigned long start2, unsigned long end2) > +{ > + /* Is 'start2' within area 1? */ > + if (start1 <= start2 && end1 > start2) > + return true; >

Re: [PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-09-04 Thread Thomas Gleixner
On Tue, 21 Aug 2018, Bin Yang wrote: > > +static inline bool > +overlap(unsigned long start1, unsigned long end1, > + unsigned long start2, unsigned long end2) > +{ > + /* Is 'start2' within area 1? */ > + if (start1 <= start2 && end1 > start2) > + return true; >

[PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-08-20 Thread Bin Yang
When changing a 4K page attr inside the large page range, try_preserve_large_page() will call static_protections() to check all 4K pages inside the large page range. In the worst case, when changing a 4K page attr inside 1G large page range, static_protections() will be called for 262144 times

[PATCH v3 4/5] x86/mm: optimize static_protection() by using overlap()

2018-08-20 Thread Bin Yang
When changing a 4K page attr inside the large page range, try_preserve_large_page() will call static_protections() to check all 4K pages inside the large page range. In the worst case, when changing a 4K page attr inside 1G large page range, static_protections() will be called for 262144 times