Commit b0bb5016 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

kprobes: use hlist_for_each_entry

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 41ac8df9
...@@ -134,8 +134,7 @@ kprobe_opcode_t __kprobes *get_insn_slot(void) ...@@ -134,8 +134,7 @@ kprobe_opcode_t __kprobes *get_insn_slot(void)
struct hlist_node *pos; struct hlist_node *pos;
retry: retry:
hlist_for_each(pos, &kprobe_insn_pages) { hlist_for_each_entry(kip, pos, &kprobe_insn_pages, hlist) {
kip = hlist_entry(pos, struct kprobe_insn_page, hlist);
if (kip->nused < INSNS_PER_PAGE) { if (kip->nused < INSNS_PER_PAGE) {
int i; int i;
for (i = 0; i < INSNS_PER_PAGE; i++) { for (i = 0; i < INSNS_PER_PAGE; i++) {
...@@ -214,9 +213,8 @@ static int __kprobes collect_garbage_slots(void) ...@@ -214,9 +213,8 @@ static int __kprobes collect_garbage_slots(void)
if (check_safety() != 0) if (check_safety() != 0)
return -EAGAIN; return -EAGAIN;
hlist_for_each_safe(pos, next, &kprobe_insn_pages) { hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) {
int i; int i;
kip = hlist_entry(pos, struct kprobe_insn_page, hlist);
if (kip->ngarbage == 0) if (kip->ngarbage == 0)
continue; continue;
kip->ngarbage = 0; /* we will collect all garbages */ kip->ngarbage = 0; /* we will collect all garbages */
...@@ -235,8 +233,7 @@ void __kprobes free_insn_slot(kprobe_opcode_t * slot, int dirty) ...@@ -235,8 +233,7 @@ void __kprobes free_insn_slot(kprobe_opcode_t * slot, int dirty)
struct kprobe_insn_page *kip; struct kprobe_insn_page *kip;
struct hlist_node *pos; struct hlist_node *pos;
hlist_for_each(pos, &kprobe_insn_pages) { hlist_for_each_entry(kip, pos, &kprobe_insn_pages, hlist) {
kip = hlist_entry(pos, struct kprobe_insn_page, hlist);
if (kip->insns <= slot && if (kip->insns <= slot &&
slot < kip->insns + (INSNS_PER_PAGE * MAX_INSN_SIZE)) { slot < kip->insns + (INSNS_PER_PAGE * MAX_INSN_SIZE)) {
int i = (slot - kip->insns) / MAX_INSN_SIZE; int i = (slot - kip->insns) / MAX_INSN_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment