Commit daa694e
getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()
Patch series "getrusage: use sig->stats_lock", v2.
This patch (of 2):
thread_group_cputime() does its own locking, we can safely shift
thread_group_cputime_adjusted() which does another for_each_thread loop
outside of ->siglock protected section.
This is also preparation for the next patch which changes getrusage() to
use stats_lock instead of siglock, thread_group_cputime() takes the same
lock. With the current implementation recursive read_seqbegin_or_lock()
is fine, thread_group_cputime() can't enter the slow mode if the caller
holds stats_lock, yet this looks more safe and better performance-wise.
Link: https://lkml.kernel.org/r/20240122155023.GA26169@redhat.com
Link: https://lkml.kernel.org/r/20240122155050.GA26205@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Dylan Hatch <dylanbhatch@google.com>
Tested-by: Dylan Hatch <dylanbhatch@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent e656c7a commit daa694e
1 file changed
Lines changed: 19 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1785 | 1785 | | |
1786 | 1786 | | |
1787 | 1787 | | |
1788 | | - | |
| 1788 | + | |
| 1789 | + | |
1789 | 1790 | | |
1790 | 1791 | | |
1791 | | - | |
| 1792 | + | |
1792 | 1793 | | |
| 1794 | + | |
1793 | 1795 | | |
1794 | 1796 | | |
1795 | 1797 | | |
1796 | 1798 | | |
1797 | 1799 | | |
1798 | | - | |
| 1800 | + | |
1799 | 1801 | | |
1800 | 1802 | | |
1801 | 1803 | | |
| |||
1819 | 1821 | | |
1820 | 1822 | | |
1821 | 1823 | | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | 1824 | | |
1826 | 1825 | | |
1827 | 1826 | | |
| |||
1839 | 1838 | | |
1840 | 1839 | | |
1841 | 1840 | | |
1842 | | - | |
1843 | | - | |
1844 | | - | |
| 1841 | + | |
| 1842 | + | |
1845 | 1843 | | |
1846 | | - | |
1847 | | - | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1848 | 1847 | | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
1853 | 1853 | | |
| 1854 | + | |
| 1855 | + | |
1854 | 1856 | | |
| 1857 | + | |
| 1858 | + | |
1855 | 1859 | | |
1856 | 1860 | | |
1857 | 1861 | | |
| |||
0 commit comments