mm/migrate: correct failure handling if !hugepage_migration_support()
[firefly-linux-kernel-4.4.55.git] / tools / perf / builtin-top.c
index 172e91a9ce6243bab1b617e7a32d45f0b6ed95d2..76cd510d34d023bf3c580ec2b3e2e217d8831cba 100644 (file)
@@ -482,7 +482,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
 
                                fprintf(stderr, "\nAvailable events:");
 
-                               list_for_each_entry(top->sym_evsel, &top->evlist->entries, node)
+                               evlist__for_each(top->evlist, top->sym_evsel)
                                        fprintf(stderr, "\n\t%d %s", top->sym_evsel->idx, perf_evsel__name(top->sym_evsel));
 
                                prompt_integer(&counter, "Enter details event counter");
@@ -493,7 +493,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
                                        sleep(1);
                                        break;
                                }
-                               list_for_each_entry(top->sym_evsel, &top->evlist->entries, node)
+                               evlist__for_each(top->evlist, top->sym_evsel)
                                        if (top->sym_evsel->idx == counter)
                                                break;
                        } else
@@ -575,7 +575,7 @@ static void *display_thread_tui(void *arg)
         * Zooming in/out UIDs. For now juse use whatever the user passed
         * via --uid.
         */
-       list_for_each_entry(pos, &top->evlist->entries, node)
+       evlist__for_each(top->evlist, pos)
                pos->hists.uid_filter_str = top->record_opts.target.uid_str;
 
        perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent,
@@ -743,15 +743,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
        if (al.sym == NULL || !al.sym->ignore) {
                struct hist_entry *he;
 
-               if ((sort__has_parent || symbol_conf.use_callchain) &&
-                   sample->callchain) {
-                       err = machine__resolve_callchain(machine, evsel,
-                                                        al.thread, sample,
-                                                        &parent, &al,
-                                                        top->max_stack);
-                       if (err)
-                               return;
-               }
+               err = sample__resolve_callchain(sample, &parent, evsel, &al,
+                                               top->max_stack);
+               if (err)
+                       return;
 
                he = perf_evsel__add_hist_entry(evsel, &al, sample);
                if (he == NULL) {
@@ -759,12 +754,9 @@ static void perf_event__process_sample(struct perf_tool *tool,
                        return;
                }
 
-               if (symbol_conf.use_callchain) {
-                       err = callchain_append(he->callchain, &callchain_cursor,
-                                              sample->period);
-                       if (err)
-                               return;
-               }
+               err = hist_entry__append_callchain(he, sample);
+               if (err)
+                       return;
 
                if (sort__has_sym)
                        perf_top__record_precise_ip(top, he, evsel->idx, ip);
@@ -858,7 +850,7 @@ static int perf_top__start_counters(struct perf_top *top)
 
        perf_evlist__config(evlist, opts);
 
-       list_for_each_entry(counter, &evlist->entries, node) {
+       evlist__for_each(evlist, counter) {
 try_again:
                if (perf_evsel__open(counter, top->evlist->cpus,
                                     top->evlist->threads) < 0) {
@@ -1171,7 +1163,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
        if (!top.evlist->nr_entries &&
            perf_evlist__add_default(top.evlist) < 0) {
                ui__error("Not enough memory for event selector list\n");
-               goto out_delete_maps;
+               goto out_delete_evlist;
        }
 
        symbol_conf.nr_events = top.evlist->nr_entries;
@@ -1181,7 +1173,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 
        if (record_opts__config(opts)) {
                status = -EINVAL;
-               goto out_delete_maps;
+               goto out_delete_evlist;
        }
 
        top.sym_evsel = perf_evlist__first(top.evlist);
@@ -1206,8 +1198,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 
        status = __cmd_top(&top);
 
-out_delete_maps:
-       perf_evlist__delete_maps(top.evlist);
 out_delete_evlist:
        perf_evlist__delete(top.evlist);