1. 28 Oct, 2013 1 commit
  2. 24 Oct, 2013 1 commit
    • Joseph Schuchart's avatar
      perf script python: Fix mem leak due to missing Py_DECREFs on dict entries · c0268e8d
      Joseph Schuchart authored
      We are using the Python scripting interface in perf to extract kernel
      events relevant for performance analysis of HPC codes. We noticed that
      the "perf script" call allocates a significant amount of memory (in the
      order of several 100 MiB) during it's run, e.g. 125 MiB for a 25 MiB
      input file:
      
        $> perf record -o perf.data -a -R -g fp \
             -e power:cpu_frequency -e sched:sched_switch \
             -e sched:sched_migrate_task -e sched:sched_process_exit \
             -e sched:sched_process_fork -e sched:sched_process_exec \
             -e cycles  -m 4096 --freq 4000
        $> /usr/bin/time perf script -i perf.data -s dummy_script.py
        0.84user 0.13system 0:01.92elapsed 51%CPU (0avgtext+0avgdata
        125532maxresident)k
        73072inputs+0outputs (57major+33086minor)pagefaults 0swaps
      
      Upon further investigation using the valgrind massif tool, we noticed
      that Python objects that are created in trace-event-python.c via
      PyString_FromString*() (and their Integer and Long counterparts) are
      never free'd.
      
      The reason for this seem to be missing Py_DECREF calls on the objects
      that are returned by these functions and stored in the Python
      dictionaries. The Python dictionaries do not steal references (as
      opposed to Python tuples and lists) but instead add their own reference.
      
      Hence, the reference that is returned by these object creation functions
      is never released and the memory is leaked. (see [1,2])
      
      The attached patch fixes this by wrapping all relevant calls to
      PyDict_SetItemString() and decrementing the reference counter
      immediately after the Python function call.
      
      This reduces the allocated memory to a reasonable amount:
      
        $> /usr/bin/time perf script -i perf.data -s dummy_script.py
        0.73user 0.05system 0:00.79elapsed 99%CPU (0avgtext+0avgdata
        49132maxresident)k
        0inputs+0outputs (0major+14045minor)pagefaults 0swaps
      
      For comparison, with a 120 MiB input file the memory consumption
      reported by time drops from almost 600 MiB to 146 MiB.
      
      The patch has been tested using Linux 3.8.2 with Python 2.7.4 and Linux
      3.11.6 with Python 2.7.5.
      
      Please let me know if you need any further information.
      
      [1] http://docs.python.org/2/c-api/tuple.html#PyTuple_SetItem
      [2] http://docs.python.org/2/c-api/dict.html#PyDict_SetItemStringSigned-off-by: default avatarJoseph Schuchart <joseph.schuchart@tu-dresden.de>
      Reviewed-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Link: http://lkml.kernel.org/r/1381468543-25334-4-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c0268e8d
  3. 20 Oct, 2013 1 commit
  4. 19 Oct, 2013 1 commit
  5. 18 Oct, 2013 7 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · bdeeab62
      Linus Torvalds authored
      Pull btrfs fix from Chris Mason:
       "Sage hit a deadlock with ceph on btrfs, and Josef tracked it down to a
        regression in our initial rc1 pull.  When doing nocow writes we were
        sometimes starting a transaction with locks held"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: release path before starting transaction in can_nocow_extent
      bdeeab62
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-3.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 797afdf7
      Linus Torvalds authored
      Pull ACPI and power management fixes from Rafael Wysocki:
      
       - intel_pstate fix for misbehavior after system resume if sysfs
         attributes are set in a specific way before the corresponding suspend
         from Dirk Brandewie.
      
       - A recent intel_pstate fix has no effect if unsigned long is 32-bit,
         so fix it up to cover that case as well.
      
       - The s3c64xx cpufreq driver was not updated when the index field of
         struct cpufreq_frequency_table was replaced with driver_data, so
         update it now.  From Charles Keepax.
      
       - The Kconfig help text for ACPI_BUTTON still refers to
         /proc/acpi/event that has been dropped recently, so modify it to
         remove that reference.  From Krzysztof Mazur.
      
       - A Lan Tianyu's change adds a missing mutex unlock to an error code
         path in acpi_resume_power_resources().
      
       - Some code related to ACPI power resources, whose very purpose is
         questionable to put it lightly, turns out to cause problems to happen
         during testing on real systems, so remove it completely (we may
         revisit that in the future if there's a compelling enough reason).
         From Rafael J Wysocki and Aaron Lu.
      
      * tag 'pm+acpi-3.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / PM: Drop two functions that are not used any more
        ATA / ACPI: remove power dependent device handling
        cpufreq: s3c64xx: Rename index to driver_data
        ACPI / power: Drop automaitc resume of power resource dependent devices
        intel_pstate: Fix type mismatch warning
        cpufreq / intel_pstate: Fix max_perf_pct on resume
        ACPI: remove /proc/acpi/event from ACPI_BUTTON help
        ACPI / power: Release resource_lock after acpi_power_get_state() return error
      797afdf7
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9219cec5
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Two fixlets:
      
         - fix a (rare-config) build bug
         - fix a next-gen SGI/UV hw/firmware enumeration bug"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86: Update UV3 hub revision ID
        x86/microcode: Correct Kconfig dependencies
      9219cec5
    • Josef Bacik's avatar
      Btrfs: release path before starting transaction in can_nocow_extent · 1bda19eb
      Josef Bacik authored
      We can't be holding tree locks while we try to start a transaction, we will
      deadlock.  Thanks,
      Reported-by: default avatarSage Weil <sage@inktank.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      1bda19eb
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-fixes' · 981984cb
      Rafael J. Wysocki authored
      * acpi-fixes:
        ACPI / PM: Drop two functions that are not used any more
        ATA / ACPI: remove power dependent device handling
        ACPI / power: Drop automaitc resume of power resource dependent devices
        ACPI: remove /proc/acpi/event from ACPI_BUTTON help
        ACPI / power: Release resource_lock after acpi_power_get_state() return error
      981984cb
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-fixes' · bdbff716
      Rafael J. Wysocki authored
      * pm-fixes:
        cpufreq: s3c64xx: Rename index to driver_data
        intel_pstate: Fix type mismatch warning
        cpufreq / intel_pstate: Fix max_perf_pct on resume
      bdbff716
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6 · 04919afb
      Linus Torvalds authored
      Pull CIFS fixes from Steve French:
       "Five small cifs fixes (includes fixes for: unmount hang, 2 security
        related, symlink, large file writes)"
      
      * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: ntstatus_to_dos_map[] is not terminated
        cifs: Allow LANMAN auth method for servers supporting unencapsulated authentication methods
        cifs: Fix inability to write files >2GB to SMB2/3 shares
        cifs: Avoid umount hangs with smb2 when server is unresponsive
        do not treat non-symlink reparse points as valid symlinks
      04919afb
  6. 17 Oct, 2013 29 commits