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

2015-07-21 Thread Borislav Petkov
On Tue, Jul 21, 2015 at 03:32:50PM +0800, Pan Xinhui wrote: > yes, we may access an freed memory at that time. Because entry is > stored in rb-tree. Need lock when we access it. Ah, we touch entry, right. > > improve the comments over memtype_lock to explain what exactly it protects. > > > lock

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

2015-07-21 Thread Pan Xinhui
hi, Borislav thanks for your reply :) On 2015年07月21日 14:55, Borislav Petkov wrote: > On Tue, Jul 21, 2015 at 02:29:35PM +0800, Pan Xinhui wrote: >> From: Pan Xinhui >> >> It's safe and more reasonable to unlock memtype_lock right after >> rbt_memtype_check_insert. >> >> Signed-off-by:

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

2015-07-21 Thread Borislav Petkov
On Tue, Jul 21, 2015 at 02:29:35PM +0800, Pan Xinhui wrote: > From: Pan Xinhui > > It's safe and more reasonable to unlock memtype_lock right after > rbt_memtype_check_insert. > > Signed-off-by: Pan Xinhui > --- > arch/x86/mm/pat.c | 7 ++- > 1 file changed, 2 insertions(+), 5

[PATCH] x86/mm/pat: Do a small optimization 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. Signed-off-by: Pan Xinhui --- arch/x86/mm/pat.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 188e3e0..cb75639

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

2015-07-21 Thread Borislav Petkov
On Tue, Jul 21, 2015 at 03:32:50PM +0800, Pan Xinhui wrote: yes, we may access an freed memory at that time. Because entry is stored in rb-tree. Need lock when we access it. Ah, we touch entry, right. improve the comments over memtype_lock to explain what exactly it protects. lock is

[PATCH] x86/mm/pat: Do a small optimization 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. Signed-off-by: Pan Xinhui xinhuix@intel.com --- arch/x86/mm/pat.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/mm/pat.c

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

2015-07-21 Thread Borislav Petkov
On Tue, Jul 21, 2015 at 02:29:35PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. Signed-off-by: Pan Xinhui xinhuix@intel.com --- arch/x86/mm/pat.c | 7 ++- 1 file

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

2015-07-21 Thread Pan Xinhui
hi, Borislav thanks for your reply :) On 2015年07月21日 14:55, Borislav Petkov wrote: On Tue, Jul 21, 2015 at 02:29:35PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert.