diff options
| author | Ingo Rohloff <[email protected]> | 2022-02-09 13:33:03 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2022-02-11 11:01:09 +0100 |
| commit | 6a3cd5bef2531a1178234efa3bed788e3b3831f0 (patch) | |
| tree | 9a7b97a9e84d34ed8c4a933d1848a6b55de6a05b /tools/perf/scripts/python/stackcollapse.py | |
| parent | c3c9cee592828528fd228b01d312c7526c584a42 (diff) | |
USB: usbfs: Use a spinlock instead of atomic accesses to tally used memory.
While the existing code code imposes a limit on the used memory, it might be
over pessimistic (even if this is unlikely).
Example scenario:
8 threads running in parallel, all entering
"usbfs_increase_memory_usage()" at the same time.
The atomic accesses in "usbfs_increase_memory_usage()" could be
serialized like this:
8 x "atomic64_add"
8 x "atomic64_read"
If the 8 x "atomic64_add" raise "usbfs_memory_usage" above the limit,
then all 8 calls of "usbfs_increase_memory_usage()" will return with
-ENOMEM. If you instead serialize over the whole access to
"usbfs_memory_usage" by using a spinlock, some of these calls will
succeed.
Acked-by: Alan Stern <[email protected]>
Signed-off-by: Ingo Rohloff <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions