uprobes/core: Remove redundant lock_page/unlock_page
Subsystems (2)
PATCH 1/3 uprobes/core: Remove redundant lock_page/unlock_page
From: Srikar Dronamraju <[email protected]>
No need to lock the page when copying the opcode in read_opcode().
--- kernel/events/uprobes.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
kernel/events/uprobes.c +0 -2
@@ -315,12 +315,10 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_if (ret <=0 )return ret; -lock_page (page); vaddr_new =kmap_atomic (page); vaddr &= ~PAGE_MASK ;memcpy (opcode, vaddr_new + vaddr,UPROBE_SWBP_INSN_SIZE );kunmap_atomic (vaddr_new); -unlock_page (page);put_page (page);
PATCH 2/3 perf/uprobes: Remove unnecessary check before strlist__delete
From: Srikar Dronamraju <[email protected]>
Since strlist__delete() itself checks, the additional check before calling strlist__delete() is redundant.
No Functional change.
--- tools/perf/util/probe-event.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
tools/perf/util/probe-event.c +2 -6
@@ -2164,16 +2164,12 @@ int del_perf_probe_events(struct strlist *dellist) error:if (kfd >=0 ) { -if (namelist) -strlist__delete (namelist); - +strlist__delete (namelist);close (kfd); }if (ufd >=0 ) { -if (unamelist) -strlist__delete (unamelist); - +strlist__delete (unamelist);close (ufd); }
[tip:perf/urgent] perf uprobes: Remove unnecessary check before strlist__delete
Commit-ID: a23c4dc422cff7bd30f40f5dc7c9ac4a6339005a Gitweb: http://git.kernel.org/tip/a23c4dc422cff7bd30f40f5dc7c9ac4a6339005a Author: Srikar Dronamraju <[email protected]> AuthorDate: Thu, 31 May 2012 17:16:43 +0530 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 31 May 2012 12:08:49 -0300
perf uprobes: Remove unnecessary check before strlist__delete
Since strlist__delete() itself checks, the additional check before calling strlist__delete() is redundant.
No Functional change.
--- tools/perf/util/probe-event.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
tools/perf/util/probe-event.c +2 -6
@@ -2164,16 +2164,12 @@ int del_perf_probe_events(struct strlist *dellist) error:if (kfd >=0 ) { -if (namelist) -strlist__delete (namelist); - +strlist__delete (namelist);close (kfd); }if (ufd >=0 ) { -if (unamelist) -strlist__delete (unamelist); - +strlist__delete (unamelist);close (ufd); }
PATCH 3/3 perf: Check for valid dso before creating map
In reply to Srikar DronamrajuFrom: Srikar Dronamraju <[email protected]>
dso__new() can return NULL. Hence verify dso before creating a new map.
--- tools/perf/util/symbol.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
tools/perf/util/symbol.c +4 -1
@@ -2786,8 +2786,11 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type,struct map *dso__new_map (const char *name) { +struct map *map =NULL ;struct dso *dso =dso__new (name); -struct map *map =map__new2 (0 , dso,MAP__FUNCTION ); + +if (dso) + map =map__new2 (0 , dso,MAP__FUNCTION );return map; }
[tip:perf/urgent] perf symbols: Check for valid dso before creating map
Commit-ID: 378474e4b23183002f1791b294a4440b6b7df36a Gitweb: http://git.kernel.org/tip/378474e4b23183002f1791b294a4440b6b7df36a Author: Srikar Dronamraju <[email protected]> AuthorDate: Thu, 31 May 2012 17:16:56 +0530 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 31 May 2012 12:08:22 -0300
perf symbols: Check for valid dso before creating map
dso__new() can return NULL. Hence verify dso before creating a new map.
--- tools/perf/util/symbol.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
tools/perf/util/symbol.c +4 -1
@@ -2817,8 +2817,11 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type,struct map *dso__new_map (const char *name) { +struct map *map =NULL ;struct dso *dso =dso__new (name); -struct map *map =map__new2 (0 , dso,MAP__FUNCTION ); + +if (dso) + map =map__new2 (0 , dso,MAP__FUNCTION );return map; }
Peter Zijlstra
maintainerQuoted 3 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
No need to lock the page when copying the opcode in
read_opcode().
It would be good if the changelog said _why_ this is so :-)
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
No need to lock the page when copying the opcode in
read_opcode().It would be good if the changelog said _why_ this is so :-)
I thought the same thing when I read it.
-- Steve
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
No need to lock the page when copying the opcode in
read_opcode().It would be good if the changelog said _why_ this is so :-)
In read_opcode(), we have the reference for the page and we only are reading from the the page. i.e we are neither modifying the page contents, not the page attributes.
Existing kernel code has enough examples where we read the contents of the page without taking the page lock.
Further this was discussed here too https://lkml.org/lkml/2012/4/17/361.
Signature · 2 lines
Thanks and Regards Srikar
Peter Zijlstra
maintainerQuoted 5 lines · Srikar Dronamraju
Quoted 3 lines · Peter Zijlstra
Quoted 2 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
No need to lock the page when copying the opcode in
read_opcode().It would be good if the changelog said _why_ this is so :-)
In
read_opcode(), we have the reference for the page and we only are reading from the the page. i.e we are neither modifying the page contents, not the page attributes.
Fair enough, so put that in the changelog. The changelog should explain things, not raise questions.
Quoted 2 lines
Existing kernel code has enough examples where we read the contents of the page without taking the page lock.
Yes, but that doesn't tell us this site is ok, doing it because others do isn't an argument.
Quoted 1 line
Further this was discussed here too https://lkml.org/lkml/2012/4/17/361.
That wasn't a discussion, that was two people saying they don't know.
Quoted 8 lines · Peter Zijlstra
Quoted 7 lines · Srikar Dronamraju
Quoted 5 lines · Peter Zijlstra
Quoted 3 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
No need to lock the page when copying the opcode in
read_opcode().
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
It would be good if the changelog said _why_ this is so :-)
In
read_opcode(), we have the reference for the page and we only are reading from the the page. i.e we are neither modifying the page contents, not the page attributes.Fair enough, so put that in the changelog. The changelog should explain things, not raise questions.
Okay, will add this info to the Changelog and resend the patch.
Signature · 2 lines
Thanks and Regards Srikar
PATCH RESEND 1/3 uprobes: Remove redundant lock_page/unlock_page
In reply to Peter ZijlstraFrom: Srikar Dronamraju <[email protected]>
Since read_opcode() reads from the referenced page and doesnt modify the page contents nor the page attributes, there is no need to lock the page.
---
Modified changelog based on comments from Peter Zijlstra
kernel/events/uprobes.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
kernel/events/uprobes.c +0 -2
@@ -315,12 +315,10 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_if (ret <=0 )return ret; -lock_page (page); vaddr_new =kmap_atomic (page); vaddr &= ~PAGE_MASK ;memcpy (opcode, vaddr_new + vaddr,UPROBE_SWBP_INSN_SIZE );kunmap_atomic (vaddr_new); -unlock_page (page);put_page (page);
Oleg Nesterov
maintainerRe: [RESEND PATCH 1/3] uprobes: Remove redundant lock_page/unlock_page
kernel/events/uprobes.c static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_ · line 323
Quoted 11 lines · Srikar Dronamraju
kernel/events/uprobes.c +0
-2@@ -315,12 +315,10 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_if (ret <=0 )return ret; -lock_page (page); vaddr_new =kmap_atomic (page); vaddr &= ~PAGE_MASK ;memcpy (opcode, vaddr_new + vaddr,UPROBE_SWBP_INSN_SIZE );kunmap_atomic (vaddr_new); -unlock_page (page);
Great, this lock_page() was really confusing.
Oleg.
Re: [RESEND PATCH 1/3] uprobes: Remove redundant lock_page/unlock_page
In reply to Srikar DronamrajuQuoted 19 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
Since
read_opcode()reads from the referenced page and doesnt modify the page contents nor the page attributes, there is no need to lock the page.Signed-off-by Srikar Dronamraju <[email protected]>---
Modified changelog based on comments from Peter Zijlstrakernel/events/uprobes.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)kernel/events/uprobes.c +0
-0@@ -315,12 +315,10 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_if (ret <=0 )
kernel/events/uprobes.c static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_ · line 323
Quoted 10 lines
kernel/events/uprobes.c +0
-2return ret; -lock_page (page); vaddr_new =kmap_atomic (page); vaddr &= ~PAGE_MASK ;memcpy (opcode, vaddr_new + vaddr,UPROBE_SWBP_INSN_SIZE );kunmap_atomic (vaddr_new); -unlock_page (page);put_page (page);
Is this also a bug fix, or can it wait until v3.6?
Thanks,
Ingo
Peter Zijlstra
maintainerRe: [RESEND PATCH 1/3] uprobes: Remove redundant lock_page/unlock_page
Quoted 1 line · Ingo Molnar
Is this also a bug fix, or can it wait until v3.6?
No bug, just superfluous locking.
Re: [RESEND PATCH 1/3] uprobes: Remove redundant lock_page/unlock_page
In reply to Srikar DronamrajuIngo,
just a "ping" message, so that this change won't be forgotten. It was waiting for v3.6: https://lkml.org/lkml/2012/6/6/134
thank you!
Anton.
Quoted 38 lines · Srikar Dronamraju
From: Srikar Dronamraju <[email protected]>
Since
read_opcode()reads from the referenced page and doesnt modify the page contents nor the page attributes, there is no need to lock the page.Signed-off-by Srikar Dronamraju <[email protected]>---
Modified changelog based on comments from Peter Zijlstrakernel/events/uprobes.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)kernel/events/uprobes.c +0
-3@@ -315,12 +315,10 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_if (ret <=0 )return ret; -lock_page (page); vaddr_new =kmap_atomic (page); vaddr &= ~PAGE_MASK ;memcpy (opcode, vaddr_new + vaddr,UPROBE_SWBP_INSN_SIZE );kunmap_atomic (vaddr_new); -unlock_page (page);put_page (page); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/