History

Merge tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Thomas Gleixner: "A set of fixes and improvements for the perf subsystem: Kernel fixes: - Install cgroup events to the correct CPU context to prevent a potential list double add - Prevent an integer underflow in the perf mlock accounting - Add a missing prototype for arch_perf_update_userpage() Tooling: - Add a missing unlock in the error path of maps__insert() in perf maps. - Fix the build with the latest libbfd - Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink configuration was missing due to the deletion. - Fix the double free in the perf CPU map merging test case - Add the missing ustring support for the perf probe command" * tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf maps: Add missing unlock to maps__insert() error case perf probe: Add ustring support for perf probe command perf: Make perf able to build with latest libbfd perf test: Fix test case Merge cpu map perf parse: Copy string to perf_evsel_config_term perf parse: Refactor 'struct perf_evsel_config_term' kernel/events: Add a missing prototype for arch_perf_update_userpage() perf/cgroups: Install cgroup events to correct cpuctx perf/core: Fix mlock accounting in perf_mmap()

Linus Torvalds committed 6 years ago

Commit ca21b9b2 parents 2fbc23c 45f035710 files · +88 −36Browse files

Showing the changes to kernel (1 of 10 files). Show all

Unified · Split

kernel/events/core.c+13−4
@@ -951,9 +951,9 @@ list_update_cgroup_event(struct perf_event *event, · 950 unmodified lines
951951
952952 /*
953953 * Because cgroup events are always per-cpu events,
954− * this will always be called from the right CPU.
954+ * @ctx == &cpuctx->ctx.
955955 */
956− cpuctx = __get_cpu_context(ctx);
956+ cpuctx = container_of(ctx, struct perf_cpu_context, ctx);
957957
958958 /*
959959 * Since setting cpuctx->cgrp is conditional on the current @cgrp
@@ -979,7 +979,8 @@ list_update_cgroup_event(struct perf_event *event, · 19 unmodified lines
979979
980980 cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;
981981 if (add)
982− list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));
982+ list_add(cpuctx_entry,
983+ per_cpu_ptr(&cgrp_cpuctx_list, event->cpu));
983984 else
984985 list_del(cpuctx_entry);
985986 }
@@ -5916,7 +5917,15 @@ accounting: · 4930 unmodified lines
59165917 */
59175918 user_lock_limit *= num_online_cpus();
59185919
5919− user_locked = atomic_long_read(&user->locked_vm) + user_extra;
5920+ user_locked = atomic_long_read(&user->locked_vm);
5921+
5922+ /*
5923+ * sysctl_perf_event_mlock may have changed, so that
5924+ * user->locked_vm > user_lock_limit
5925+ */
5926+ if (user_locked > user_lock_limit)
5927+ user_locked = user_lock_limit;
5928+ user_locked += user_extra;
59205929
59215930 if (user_locked > user_lock_limit) {
59225931 /*