Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Thomas Gleixner
On Tue, 21 Jul 2015, Pan Xinhui wrote: > So *ret_type might be set to found_type(match->type), > > The call train is deep, it took me long time to review them. > As actual_type != new->type is possible, we need save new->type to > actual_type. Fair enough. But that wants to have a comment in

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
hi, tglx thanks for your reply :) On 2015年07月21日 16:10, Thomas Gleixner wrote: > On Tue, 21 Jul 2015, Pan Xinhui wrote: >> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c >> index 188e3e0..f3c49fa 100644 >> --- a/arch/x86/mm/pat.c >> +++ b/arch/x86/mm/pat.c >> @@ -538,22 +538,20 @@ int

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Thomas Gleixner
On Tue, 21 Jul 2015, Pan Xinhui wrote: > diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c > index 188e3e0..f3c49fa 100644 > --- a/arch/x86/mm/pat.c > +++ b/arch/x86/mm/pat.c > @@ -538,22 +538,20 @@ int reserve_memtype(u64 start, u64 end, enum > page_cache_mode req_type, > new->type

[PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
From: Pan Xinhui It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. It's not cool to call kfree, pr_info, etc with this lock held. So move spin_unlock a little ahead. memory_lock protects data stored in rb-tree, if *new* succeed to be stored into the

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Thomas Gleixner
On Tue, 21 Jul 2015, Pan Xinhui wrote: So *ret_type might be set to found_type(match-type), The call train is deep, it took me long time to review them. As actual_type != new-type is possible, we need save new-type to actual_type. Fair enough. But that wants to have a comment in the code

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
hi, tglx thanks for your reply :) On 2015年07月21日 16:10, Thomas Gleixner wrote: On Tue, 21 Jul 2015, Pan Xinhui wrote: diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 188e3e0..f3c49fa 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -538,22 +538,20 @@ int

[PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. It's not cool to call kfree, pr_info, etc with this lock held. So move spin_unlock a little ahead. memory_lock protects data stored in rb-tree, if *new* succeed to be

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Thomas Gleixner
On Tue, 21 Jul 2015, Pan Xinhui wrote: diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 188e3e0..f3c49fa 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -538,22 +538,20 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type, new-type =