164 Commits

Author SHA1 Message Date
pwnrazr
1a43f2700f Merge remote-tracking branch 'android-stable/android-4.14-stable' into dev-base 2023-02-14 12:45:21 +02:00
kondors1995
732ff49539 Revert 4.19 walt backports
Squashed commit of the following:

commit e0da409d20a1120c48f7c7c59a86df2d0e78dff1
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:28 2022 +0000

    Revert "Revert "sched/core: Fix migration to invalid CPU in __set_cpus_allowed_ptr()""

    This reverts commit 8cb322ba44.

commit 04e33109bae2cb907809e9e72dc78b4b0e9d90d9
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:27 2022 +0000

    Revert "sched/fair: Derive the downmigration margin wrt the destination CPU"

    This reverts commit 51e64c1746.

commit dc6a3a970d523bc734e97ad0596990a553958bf0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:26 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit b1d4f5bde5.

commit 51e5e01f3aefc05555161d6d1ababc6d6820dd88
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:25 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit e376cd40d2.

commit bb816a5803a37721c54fc9911a8a715b0198713c
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:24 2022 +0000

    Revert "sched/fair: Refactor packing eligible test"

    This reverts commit cf6c2a22b4.

commit 1008281e2aacf59465ea31d1176870759f91a774
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:23 2022 +0000

    Revert "sched: improve the scheduler"

    This reverts commit 64813e3d15.

commit 3b75a59b7b65dee631983e5abde1c002f460a521
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:22 2022 +0000

    Revert "sched/fair: Allow prev cpu in find best target"

    This reverts commit 1fe0f64b5a.

commit e197f8cdca5c05f70ba6ada8dd3e2e800bafe0fc
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:21 2022 +0000

    Revert "sched/fair: Fix excessive packing on the max capacity CPU"

    This reverts commit a88cad82cf.

commit 1d908d935c132824ab580f976d9fce751ab502f8
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:20 2022 +0000

    Revert "sched/fair: upadte adjust_cpus_for_packing()"

    This reverts commit 08fc238c86.

commit 35dfbb767009eea348be9ac3417b26981abdd084
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:19 2022 +0000

    Revert "sched: clean-up unused/duplicate functions & variables"

    This reverts commit f79c18f23b.

commit 628d78cac047cf164f1cca797b759a43b31696a9
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:17 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit e9fb7c0c28.

commit 0c142a2c77c8e418112613305eb7c87063057890
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:16 2022 +0000

    Revert "sched: walt: Improve the scheduler"

    This reverts commit ad12d47ad6.

commit 2391d0e3d7d4af22524dce0b26d795f882fde0db
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:15 2022 +0000

    Revert "sched: Cleanup unused variables in walt"

    This reverts commit 0e968578ac.

commit e91fd23c44195b9c78a5886cff0cd56990d61137
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:14 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 863d26df6d.

commit e24b63cc81d5972d0e34a6c37e060cdd64f89771
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:13 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 994a047706.

commit a34d6a00b583d4a7317a82d92522d5f3bda3298b
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:12 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit baa8d4249a.

commit a662ab5cc78cc1cac9a60d2724ae61535cf59b44
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:10 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit e265dccce7.

commit 62d089b4eb705f00a516a2a385c15be3fad2d121
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:09 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 336a7071de.

commit 099a09326ea2861a907fe1b4100f9ffc919bb81f
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:08 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 44961a76c8.

commit 68a7976e08cb6bff6dff6e4cea50797db7f97d46
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:07 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit b3bb2f6702.

commit ce15f63df0b323f21571e578b78279f5b73ac55a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:06 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 5e8ba22939.

commit da639b7d4ed1640374429b7e84a228aab2594b60
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:05 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 0d154364e0.

commit 6453444f3a69837c4c59d7b3776b1e9a6c83d3b0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:04 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 2d4e6b3850.

commit 60c9ef39c478a270982b4ac74be4cfdd949fcea4
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:03 2022 +0000

    Revert "Revert "sched/walt: Fix clusters sorting when cpufreq is disabled""

    This reverts commit ecb2fca5a5.

commit 33af0f5a305d28ab8f987fe3757d125a2bf8f130
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:02 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit f00a64321e.

commit f3fe9acea84ec9559e5b535398cd834f625adafd
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:15:01 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit ca3cf0c1f8.

commit fff2855a694922257cafba5c566d738658410006
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:59 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit c66e488424.

commit 330f224e9601caf2400b15949cccdbb08f8761eb
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:58 2022 +0000

    Revert "sched/fair: Fix incorrect CPU access in check_for_migration()"

    This reverts commit 16dc974f96.

commit eb3f2244ddf02170cc0fccb6aa9c2fc2b6dfd6ca
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:57 2022 +0000

    Revert "sched/isolcpus: Fix "isolcpus=" boot parameter handling when !CONFIG_CPUMASK_OFFSTACK"

    This reverts commit 5ef4e5cef6.

commit b64c764d8daf65dfd447efd89413d6d5f3381751
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:56 2022 +0000

    Revert "sched/walt: drop preferred_cluster from rtg"

    This reverts commit 1ce7c8a179.

commit 457b01d4c8813018619e195955775e6d4ea66c9a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:55 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit bd092bfed6.

commit 47c826dd511e3737e4b53cd9f0472c3f823ecbd3
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:54 2022 +0000

    Revert "sched/core_ctl: Improve the scheduler"

    This reverts commit 8964743af3.

commit f0cf13df89999757c4da2e886c6cdd765ea2e3b6
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:53 2022 +0000

    Revert "sched/core_ctl: Improve the scheduler"

    This reverts commit 92e14b075c.

commit 1adc283c65f9515513e5a30cd905b4b8b6809332
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:52 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 5c94ee0b1a.

commit 1e8a22f9053996f2180bf36e628680989f7f90bb
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:51 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 3ae8342c24.

commit e45b6f52bdc9b22c01eec659861960506724bca7
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:50 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 9990dee761.

commit 033162e61ddfbe1246f67a753ea0e8d43e15fa7a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:49 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit e3bae83cac.

commit 100777f449cab40087d7c7eaffeea6f10c5585f0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:47 2022 +0000

    Revert "arm64/kernel/topology: Cleanup for upstream commit"

    This reverts commit a25719b05f.

commit 0391ca54d164ad24c8376adc70def2e7a5faa6a0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:46 2022 +0000

    Revert "arch_topology: Add possible sibling cpu mask for cpu_topology"

    This reverts commit 3f85bf06fc.

commit 734e104fbb95479ccc65e8328d4593d75f9ddffc
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:45 2022 +0000

    Revert "sched: core: Fix usage of cpu core group mask"

    This reverts commit 2d611d5b65.

commit dc146ddb1e552bfb36bdc8bec88c0b7cd216db55
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:44 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 2c99a96fa9.

commit 81507941532a132c8cb6ec88b2826e5b2395df26
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:43 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 834321e1fa.

commit f9f1c603aafec86a0cae9510b12f6775ca32319a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:42 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit d56300430c.

commit 070be3e6c57af46d64b10d2d7668f6cd8d4fe81c
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:41 2022 +0000

    Revert "sched: Introduce sched_busy_hysteresis_enable_cpus tunable"

    This reverts commit 4ec8a76524.

commit da2d5427df5ca95ad10619565f51fa8289eeddb0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:40 2022 +0000

    Revert "sched: Use bitmask for sched_busy_hysteresis_enable_cpus tunable"

    This reverts commit 8ff5bf1a85.

commit af0dd2fa72ae04535e7b2a6ba7344bd4fc261fac
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:38 2022 +0000

    Revert "sched: Remove unused code in sched_avg.c"

    This reverts commit 33d95a041f.

commit 365ccf7a4b2255ac4bc7e55479a9d0baa7de9cf8
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:37 2022 +0000

    Revert "lpm-levels: Optimize and make way for upstream changes"

    This reverts commit 6b1e097698.

commit 27379e7c071a3b1b00e53dccd8c9fd7aa720aa19
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:36 2022 +0000

    Revert "cpuidle: lpm-levels: get bias time from scheduler"

    This reverts commit facfee4aad.

commit b08d8d2fca732aa7b69f3c71bff0274cfa3d17cb
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:35 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit cc9cafa54a.

commit 1ce46c9093dcfc81288a2d9927af040bdcf73e14
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:34 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 4543b1af46.

commit 08cfdca5dd69adae0a5d9ece4aa7c91bd1d26199
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:33 2022 +0000

    Revert "sched: walt: Improve the Scheduler"

    This reverts commit e7ea5478b6.

commit deb41564605954c1c933cd8e2b4303e9511d2026
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:32 2022 +0000

    Revert "sched: walt: remove unused variable"

    This reverts commit db642f679e.

commit 9daaaa5c3e5e550973d241360e6cb4ae71eff1f2
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:31 2022 +0000

    Revert "sched: improve the scheduler"

    This reverts commit 0a8cbbef67.

commit 6b92b54daacfdfc35beeddcad64db64933122cf1
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:30 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit a8f97c3ca1.

commit fb4945792c7b9986e65a0c67c87158cc0d79ed68
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:28 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 5c0ced5d9d.

commit c3059eedcb167b8497f285886048449dabaa3329
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:27 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit b46bc087bd.

commit e484ee8fe7035dbce43cb177b6672cfeddbd7d56
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:26 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 3366cd2842.

commit 779543197fe683968ce5fcee6f439c62edfdbd9a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:25 2022 +0000

    Revert "sched: walt: Dump walt status on BUG_ON"

    This reverts commit c6983696d2.

commit ac1128af676e0228ffd17c99d858398dd7bc2c12
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:24 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 71925eb668.

commit 5dbef64c7db76e1d41f5afd7c695974cfaac1144
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:23 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 276ff38e69.

commit 4ee3bde67112f36c6773e53be4ec155378a58c57
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:22 2022 +0000

    Revert "sched: walt: fix sched_cluster initialization"

    This reverts commit 616dfe7582.

commit 504de651828c72fac4a1faf310b393a85c73dba4
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:21 2022 +0000

    Revert "sched: core: Use sched_clusters for updown migration handler"

    This reverts commit bcf375b081.

commit 8174458135535f1821f4818968d93001377f0276
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:20 2022 +0000

    Revert "sched: walt: Improve the scheduler"

    This reverts commit 26703509e9.

commit 8040981a5cd14d38db10e5dbbd80a14e8008c8a9
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:19 2022 +0000

    Revert "sched/walt: Avoid walt irq work in offlined cpu"

    This reverts commit ca0a0ab303.

commit 74e9893b6c08224fabf46a121e86906965812eb7
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:18 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 582c417446.

commit d9a19150ca651bc83d3343747b22ccce17bb0b81
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:16 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit a33ebcf1a5.

commit 04cfe69badf318b7e17a21b170366f90bdf43b30
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:15 2022 +0000

    Revert "sched/walt: cleanup unused code"

    This reverts commit e6b442ca5b.

commit 56e3aa3effab63ec2b676085b39dcf67703f468a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:14 2022 +0000

    Revert "sched: walt: improve the scheduler"

    This reverts commit 9ba601ed8e.

commit cb051b1f707e4882aecee1c8dd7eb1ec3b0410f0
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:13 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 044275646a.

commit 881007c0098c70dddeab5f95aa3183bbf775603d
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:12 2022 +0000

    Revert "sched: walt: Improve the scheduler"

    This reverts commit 57dde83208.

commit 4b2477928d4c47db7fc73234ee1674091e281414
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:11 2022 +0000

    Revert "sched: walt: Improve the scheduler"

    This reverts commit e2d12493b9.

commit 488d2f7d29d551d77baaef3dd6373bb8834c2e6f
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:10 2022 +0000

    Revert "sched/walt: Fix kernel panic issue by uninitialized data"

    This reverts commit 188d0b63d8.

commit 883e23ece4e293f03e4a82af560acf25acf239ab
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:14:08 2022 +0000

    Revert "sched: core_ctl: Improve the scheduler"

    This reverts commit 9b7e0b5f21.

commit 958cb0d96b1d482367fc098d8cc272e87f951778
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:40 2022 +0000

    Revert "sched/fair: Don't place wakee on waker cpu if colocate enabled"

    This reverts commit 8601883f77.

commit d210850cb0ed56404e69d8f1bd861f3d60ea11c7
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:27 2022 +0000

    Revert "sched/cpufreq_schedutil: create a function for common steps"

    This reverts commit 9d8e438e96.

commit c99ccf59736d9ad8c85b671257d51b5d77fc6ae6
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:26 2022 +0000

    Revert "cpufreq: schedutil: Queue sugov irq work on policy online cpu"

    This reverts commit f4a7dc5aa1.

commit ec851ca3918470d88c17c28625b31f1f9aaa3817
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:25 2022 +0000

    Revert "cpufreq: Avoid leaving stale IRQ work items during CPU offline"

    This reverts commit 03029dc44f.

commit d369a7c3f411362e7e86838c0c5b245496e5ecf3
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:24 2022 +0000

    Revert "sched: fair: Stop running idle_balance on active migration kick"

    This reverts commit f8fdaaa848.

commit 0933780bb1ef84cf5f7a1beba11128888e67bef8
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:23 2022 +0000

    Revert "sched: Improve the scheduler"

    This reverts commit 84ace0489f.

commit f9531a065ca011b87ad8f2f3c6aa4fdf11228f19
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:21 2022 +0000

    Revert "sched: fair: Improve the scheduler"

    This reverts commit a5b78d7ac5.

commit 4e8db29f70d6793d50cd7c88e40f763c6e97b84c
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:20 2022 +0000

    Revert "sched/fair: remove unused variable"

    This reverts commit 1dcc8eb8a5.

commit 509b3a23dd53000fdb9734e95aa173d36de0072c
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:19 2022 +0000

    Revert "sched/fair: Cleanup for incoming upstream changes"

    This reverts commit 23bda40eae.

commit 5c3a880db3a913d35a679b490a904d82baf0fcb7
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:18 2022 +0000

    Revert "sched/fair: Cleanup for incoming upstream changes"

    This reverts commit 3be3cb8ef9.

commit 3de879456c8e4dd958976f5401458c8a1e7d06bf
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:17 2022 +0000

    Revert "sched/fair: Force gold cpus to do idle lb when silver has big tasks"

    This reverts commit 9a28daeff9.

commit fc407cdd5f935dc09138232eda906be64babe078
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:15 2022 +0000

    Revert "sched/fair: Avoid force newly idle load balance if have iowait task"

    This reverts commit 7ab60698b4.

commit aa2f0e5475d7617825863870cbfe911c94bb349c
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:14 2022 +0000

    Revert "sched: Add support to spread tasks"

    This reverts commit 498769889e.

commit dfb558643fcad1eb47eeedd3c3b79526dccf29af
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:13 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 66934ec9de.

commit 5331542fb14397de915e0ee8401f2d4834cfcce5
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:12 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 9775bcc63e.

commit 699dab97a2a180453621562c1c25e9374c15942a
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:11 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit 0673f890b2.

commit 8dbc5b59fa5b0baae560a7080b45c5785ce17825
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:10 2022 +0000

    Revert "sched/walt: Improve the scheduler"

    This reverts commit f2c76a4b63.

commit 613fc288a80db796b7d366aebbafd036010f918b
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:08 2022 +0000

    Revert "sched/fair: Tighten prefer_spread feature"

    This reverts commit 88be255f29.

commit 852249f0a586ed1d1acec2efc653b5dfbc4095a8
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:07 2022 +0000

    Revert "sched/fair: Add timeout for detach_tasks() in load balance"

    This reverts commit e4b2c9df2a.

commit 3f4e2e4785b1986d338f3ff8e9f38ef6f9c666bd
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:06 2022 +0000

    Revert "sched/walt: Avoid taking rq lock for every IRQ update"

    This reverts commit b03a5af6b4.

commit a94a2242cb47d1fc216173b69ef1fe15ecc152b4
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:13:02 2022 +0000

    Revert "ANDROID: sched: fair: balance for single core cluster"

    This reverts commit b30f8c0381.

commit e3b844e3251e3fcf5b89ca3935e4aaa3c383bff4
Author: kondors1995 <normandija1945@gmail.com>
Date:   Tue Apr 12 07:11:50 2022 +0000

    Revert "rcu/nocb: Perform deferred wake up before last idle's need_resched() check"

    This reverts commit 8a6d3eaab1.
2022-04-18 11:35:12 +00:00
Sai Harshini Nimmala
5c0ced5d9d sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I8459bcf7b412a5f301566054c28c910567548485
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2021-04-12 07:13:38 +00:00
Joonwoo Park
e1ea5a4575 sched: introduce sched_{up,down}migrate knobs
Introduce knobs sched_upmigrate and sched_downmigrate to
control thresholds to up and down migrate tasks between clusters at a
runtime for ease of power and performance tuning.

Change-Id: I17a464388b404b61d9a9dbe1beee4883c4db8e3f
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[satyap@codeaurora.org: resolve merge conflicts & update
functinality as needed on msm-4.14]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2018-01-23 13:08:08 -08:00
Arnd Bergmann
e609a6b851 sysctl: add register_sysctl() dummy helper
register_sysctl() has been around for five years with commit
fea478d410 ("sysctl: Add register_sysctl for normal sysctl users") but
now that arm64 started using it, I ran into a compile error:

  arch/arm64/kernel/armv8_deprecated.c: In function 'register_insn_emulation_sysctl':
  arch/arm64/kernel/armv8_deprecated.c:257:2: error: implicit declaration of function 'register_sysctl'

This adds a inline function like we already have for
register_sysctl_paths() and register_sysctl_table().

Link: http://lkml.kernel.org/r/20171106133700.558647-1-arnd@arndb.de
Fixes: 38b9aeb32fa7 ("arm64: Port deprecated instruction emulation to new sysctl interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: Alex Benne <alex.bennee@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-09 17:58:40 -08:00
Greg Kroah-Hartman
b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Linus Torvalds
e06fdaf40a Merge tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull structure randomization updates from Kees Cook:
 "Now that IPC and other changes have landed, enable manual markings for
  randstruct plugin, including the task_struct.

  This is the rest of what was staged in -next for the gcc-plugins, and
  comes in three patches, largest first:

   - mark "easy" structs with __randomize_layout

   - mark task_struct with an optional anonymous struct to isolate the
     __randomize_layout section

   - mark structs to opt _out_ of automated marking (which will come
     later)

  And, FWIW, this continues to pass allmodconfig (normal and patched to
  enable gcc-plugins) builds of x86_64, i386, arm64, arm, powerpc, and
  s390 for me"

* tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  randstruct: opt-out externally exposed function pointer structs
  task_struct: Allow randomized layout
  randstruct: Mark various structs for randomization
2017-07-19 08:55:18 -07:00
Linus Torvalds
ad51271afc Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton:

- various misc things

- kexec updates

- sysctl core updates

- scripts/gdb udpates

- checkpoint-restart updates

- ipc updates

- kernel/watchdog updates

- Kees's "rough equivalent to the glibc _FORTIFY_SOURCE=1 feature"

- "stackprotector: ascii armor the stack canary"

- more MM bits

- checkpatch updates

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (96 commits)
  writeback: rework wb_[dec|inc]_stat family of functions
  ARM: samsung: usb-ohci: move inline before return type
  video: fbdev: omap: move inline before return type
  video: fbdev: intelfb: move inline before return type
  USB: serial: safe_serial: move __inline__ before return type
  drivers: tty: serial: move inline before return type
  drivers: s390: move static and inline before return type
  x86/efi: move asmlinkage before return type
  sh: move inline before return type
  MIPS: SMP: move asmlinkage before return type
  m68k: coldfire: move inline before return type
  ia64: sn: pci: move inline before type
  ia64: move inline before return type
  FRV: tlbflush: move asmlinkage before return type
  CRIS: gpio: move inline before return type
  ARM: HP Jornada 7XX: move inline before return type
  ARM: KVM: move asmlinkage before type
  checkpatch: improve the STORAGE_CLASS test
  mm, migration: do not trigger OOM killer when migrating memory
  drm/i915: use __GFP_RETRY_MAYFAIL
  ...
2017-07-13 12:38:49 -07:00
Luis R. Rodriguez
61d9b56a89 sysctl: add unsigned int range support
To keep parity with regular int interfaces provide the an unsigned int
proc_douintvec_minmax() which allows you to specify a range of allowed
valid numbers.

Adding proc_douintvec_minmax_sysadmin() is easy but we can wait for an
actual user for that.

Link: http://lkml.kernel.org/r/20170519033554.18592-6-mcgrof@kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12 16:26:00 -07:00
Eric W. Biederman
2fd1d2c4ce proc: Fix proc_sys_prune_dcache to hold a sb reference
Andrei Vagin writes:
FYI: This bug has been reproduced on 4.11.7
> BUG: Dentry ffff895a3dd01240{i=4e7c09a,n=lo}  still in use (1) [unmount of proc proc]
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 13588 at fs/dcache.c:1445 umount_check+0x6e/0x80
> CPU: 1 PID: 13588 Comm: kworker/1:1 Not tainted 4.11.7-200.fc25.x86_64 #1
> Hardware name: CompuLab sbc-flt1/fitlet, BIOS SBCFLT_0.08.04 06/27/2015
> Workqueue: events proc_cleanup_work
> Call Trace:
>  dump_stack+0x63/0x86
>  __warn+0xcb/0xf0
>  warn_slowpath_null+0x1d/0x20
>  umount_check+0x6e/0x80
>  d_walk+0xc6/0x270
>  ? dentry_free+0x80/0x80
>  do_one_tree+0x26/0x40
>  shrink_dcache_for_umount+0x2d/0x90
>  generic_shutdown_super+0x1f/0xf0
>  kill_anon_super+0x12/0x20
>  proc_kill_sb+0x40/0x50
>  deactivate_locked_super+0x43/0x70
>  deactivate_super+0x5a/0x60
>  cleanup_mnt+0x3f/0x90
>  mntput_no_expire+0x13b/0x190
>  kern_unmount+0x3e/0x50
>  pid_ns_release_proc+0x15/0x20
>  proc_cleanup_work+0x15/0x20
>  process_one_work+0x197/0x450
>  worker_thread+0x4e/0x4a0
>  kthread+0x109/0x140
>  ? process_one_work+0x450/0x450
>  ? kthread_park+0x90/0x90
>  ret_from_fork+0x2c/0x40
> ---[ end trace e1c109611e5d0b41 ]---
> VFS: Busy inodes after unmount of proc. Self-destruct in 5 seconds.  Have a nice day...
> BUG: unable to handle kernel NULL pointer dereference at           (null)
> IP: _raw_spin_lock+0xc/0x30
> PGD 0

Fix this by taking a reference to the super block in proc_sys_prune_dcache.

The superblock reference is the core of the fix however the sysctl_inodes
list is converted to a hlist so that hlist_del_init_rcu may be used.  This
allows proc_sys_prune_dache to remove inodes the sysctl_inodes list, while
not causing problems for proc_sys_evict_inode when if it later choses to
remove the inode from the sysctl_inodes list.  Removing inodes from the
sysctl_inodes list allows proc_sys_prune_dcache to have a progress
guarantee, while still being able to drop all locks.  The fact that
head->unregistering is set in start_unregistering ensures that no more
inodes will be added to the the sysctl_inodes list.

Previously the code did a dance where it delayed calling iput until the
next entry in the list was being considered to ensure the inode remained on
the sysctl_inodes list until the next entry was walked to.  The structure
of the loop in this patch does not need that so is much easier to
understand and maintain.

Cc: stable@vger.kernel.org
Reported-by: Andrei Vagin <avagin@gmail.com>
Tested-by: Andrei Vagin <avagin@openvz.org>
Fixes: ace0c791e6 ("proc/sysctl: Don't grab i_lock under sysctl_lock.")
Fixes: d6cffbbe9a ("proc/sysctl: prune stale dentries during unregistering")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2017-07-11 11:01:24 -05:00
Kees Cook
3859a271a0 randstruct: Mark various structs for randomization
This marks many critical kernel structures for randomization. These are
structures that have been targeted in the past in security exploits, or
contain functions pointers, pointers to function pointer tables, lists,
workqueues, ref-counters, credentials, permissions, or are otherwise
sensitive. This initial list was extracted from Brad Spengler/PaX Team's
code in the last public patch of grsecurity/PaX based on my understanding
of the code. Changes or omissions from the original code are mine and
don't reflect the original grsecurity/PaX code.

Left out of this list is task_struct, which requires special handling
and will be covered in a subsequent patch.

Signed-off-by: Kees Cook <keescook@chromium.org>
2017-06-30 12:00:51 -07:00
Eric W. Biederman
b54807fa52 sysctl: Remove dead register_sysctl_root
The function no longer does anything.  The is only a single caller of
register_sysctl_root when semantically there should be two.  Remove
this function so that if someone decides this functionality is needed
again it will be obvious all of the callers of setup_sysctl_set need
to be audited and modified appropriately.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2017-04-16 23:42:49 -05:00
Konstantin Khlebnikov
d6cffbbe9a proc/sysctl: prune stale dentries during unregistering
Currently unregistering sysctl table does not prune its dentries.
Stale dentries could slowdown sysctl operations significantly.

For example, command:

 # for i in {1..100000} ; do unshare -n -- sysctl -a &> /dev/null ; done
 creates a millions of stale denties around sysctls of loopback interface:

 # sysctl fs.dentry-state
 fs.dentry-state = 25812579  24724135        45      0       0       0

 All of them have matching names thus lookup have to scan though whole
 hash chain and call d_compare (proc_sys_compare) which checks them
 under system-wide spinlock (sysctl_lock).

 # time sysctl -a > /dev/null
 real    1m12.806s
 user    0m0.016s
 sys     1m12.400s

Currently only memory reclaimer could remove this garbage.
But without significant memory pressure this never happens.

This patch collects sysctl inodes into list on sysctl table header and
prunes all their dentries once that table unregisters.

Konstantin Khlebnikov <khlebnikov@yandex-team.ru> writes:
> On 10.02.2017 10:47, Al Viro wrote:
>> how about >> the matching stats *after* that patch?
>
> dcache size doesn't grow endlessly, so stats are fine
>
> # sysctl fs.dentry-state
> fs.dentry-state = 92712	58376	45	0	0	0
>
> # time sysctl -a &>/dev/null
>
> real	0m0.013s
> user	0m0.004s
> sys	0m0.008s

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2017-02-13 17:00:06 +13:00
Linus Torvalds
14986a34e1 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull namespace updates from Eric Biederman:
 "This set of changes is a number of smaller things that have been
  overlooked in other development cycles focused on more fundamental
  change. The devpts changes are small things that were a distraction
  until we managed to kill off DEVPTS_MULTPLE_INSTANCES. There is an
  trivial regression fix to autofs for the unprivileged mount changes
  that went in last cycle. A pair of ioctls has been added by Andrey
  Vagin making it is possible to discover the relationships between
  namespaces when referring to them through file descriptors.

  The big user visible change is starting to add simple resource limits
  to catch programs that misbehave. With namespaces in general and user
  namespaces in particular allowing users to use more kinds of
  resources, it has become important to have something to limit errant
  programs. Because the purpose of these limits is to catch errant
  programs the code needs to be inexpensive to use as it always on, and
  the default limits need to be high enough that well behaved programs
  on well behaved systems don't encounter them.

  To this end, after some review I have implemented per user per user
  namespace limits, and use them to limit the number of namespaces. The
  limits being per user mean that one user can not exhause the limits of
  another user. The limits being per user namespace allow contexts where
  the limit is 0 and security conscious folks can remove from their
  threat anlysis the code used to manage namespaces (as they have
  historically done as it root only). At the same time the limits being
  per user namespace allow other parts of the system to use namespaces.

  Namespaces are increasingly being used in application sand boxing
  scenarios so an all or nothing disable for the entire system for the
  security conscious folks makes increasing use of these sandboxes
  impossible.

  There is also added a limit on the maximum number of mounts present in
  a single mount namespace. It is nontrivial to guess what a reasonable
  system wide limit on the number of mount structure in the kernel would
  be, especially as it various based on how a system is using
  containers. A limit on the number of mounts in a mount namespace
  however is much easier to understand and set. In most cases in
  practice only about 1000 mounts are used. Given that some autofs
  scenarious have the potential to be 30,000 to 50,000 mounts I have set
  the default limit for the number of mounts at 100,000 which is well
  above every known set of users but low enough that the mount hash
  tables don't degrade unreaonsably.

  These limits are a start. I expect this estabilishes a pattern that
  other limits for resources that namespaces use will follow. There has
  been interest in making inotify event limits per user per user
  namespace as well as interest expressed in making details about what
  is going on in the kernel more visible"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (28 commits)
  autofs:  Fix automounts by using current_real_cred()->uid
  mnt: Add a per mount namespace limit on the number of mounts
  netns: move {inc,dec}_net_namespaces into #ifdef
  nsfs: Simplify __ns_get_path
  tools/testing: add a test to check nsfs ioctl-s
  nsfs: add ioctl to get a parent namespace
  nsfs: add ioctl to get an owning user namespace for ns file descriptor
  kernel: add a helper to get an owning user namespace for a namespace
  devpts: Change the owner of /dev/pts/ptmx to the mounter of /dev/pts
  devpts: Remove sync_filesystems
  devpts: Make devpts_kill_sb safe if fsi is NULL
  devpts: Simplify devpts_mount by using mount_nodev
  devpts: Move the creation of /dev/pts/ptmx into fill_super
  devpts: Move parse_mount_options into fill_super
  userns: When the per user per user namespace limit is reached return ENOSPC
  userns; Document per user per user namespace limits.
  mntns: Add a limit on the number of mount namespaces.
  netns: Add a limit on the number of net namespaces
  cgroupns: Add a limit on the number of cgroup namespaces
  ipcns: Add a  limit on the number of ipc namespaces
  ...
2016-10-06 09:52:23 -07:00
David S. Miller
6abdd5f593 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
All three conflicts were cases of simple overlapping
changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
2016-08-30 00:54:02 -04:00
Subash Abhinov Kasiviswanathan
e7d316a02f sysctl: handle error writing UINT_MAX to u32 fields
We have scripts which write to certain fields on 3.18 kernels but this
seems to be failing on 4.4 kernels.  An entry which we write to here is
xfrm_aevent_rseqth which is u32.

  echo 4294967295  > /proc/sys/net/core/xfrm_aevent_rseqth

Commit 230633d109 ("kernel/sysctl.c: detect overflows when converting
to int") prevented writing to sysctl entries when integer overflow
occurs.  However, this does not apply to unsigned integers.

Heinrich suggested that we introduce a new option to handle 64 bit
limits and set min as 0 and max as UINT_MAX.  This might not work as it
leads to issues similar to __do_proc_doulongvec_minmax.  Alternatively,
we would need to change the datatype of the entry to 64 bit.

  static int __do_proc_doulongvec_minmax(void *data, struct ctl_table
  {
      i = (unsigned long *) data;   //This cast is causing to read beyond the size of data (u32)
      vleft = table->maxlen / sizeof(unsigned long); //vleft is 0 because maxlen is sizeof(u32) which is lesser than sizeof(unsigned long) on x86_64.

Introduce a new proc handler proc_douintvec.  Individual proc entries
will need to be updated to use the new handler.

[akpm@linux-foundation.org: coding-style fixes]
Fixes: 230633d109 ("kernel/sysctl.c:detect overflows when converting to int")
Link: http://lkml.kernel.org/r/1471479806-5252-1-git-send-email-subashab@codeaurora.org
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-26 17:39:35 -07:00
Dmitry Torokhov
e79c6a4fc9 net: make net namespace sysctls belong to container's owner
If net namespace is attached to a user namespace let's make container's
root owner of sysctls affecting said network namespace instead of global
root.

This also allows us to clean up net_ctl_permissions() because we do not
need to fudge permissions anymore for the container's owner since it now
owns the objects in question.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-08-14 21:08:58 -07:00
Eric W. Biederman
13bcc6a285 sysctl: Stop implicitly passing current into sysctl_table_root.lookup
Passing nsproxy into sysctl_table_root.lookup was a premature
optimization in attempt to avoid depending on current.  The
directory /proc/self/sys has not appeared and if and when
it does this code will need to be reviewed closely and reworked
anyway.  So remove the premature optimization.

Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2016-08-08 09:17:16 -05:00
Alexey Dobriyan
db3f600124 uapi: move forward declarations of internal structures
Don't user forward declarations of internal kernel structures in headers
exported to userspace.

Move "struct completion;".
Move "struct task_struct;".

Link: http://lkml.kernel.org/r/20160713215808.GA22486@p183.telecom.by
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-02 17:31:41 -04:00
Eric W. Biederman
f9bd6733d3 sysctl: Allow creating permanently empty directories that serve as mountpoints.
Add a magic sysctl table sysctl_mount_point that when used to
create a directory forces that directory to be permanently empty.

Update the code to use make_empty_dir_inode when accessing permanently
empty directories.

Update the code to not allow adding to permanently empty directories.

Update /proc/sys/fs/binfmt_misc to be a permanently empty directory.

Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2015-07-01 10:36:39 -05:00
Heinrich Schuchardt
16db3d3f11 kernel/sysctl.c: threads-max observe limits
Users can change the maximum number of threads by writing to
/proc/sys/kernel/threads-max.

With the patch the value entered is checked against the same limits that
apply when fork_init is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17 09:04:07 -04:00
Joe Perches
e5eea0981a sysctl: remove typedef ctl_table
Remove the final user, and the typedef itself.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:24 -07:00
Eric W. Biederman
73f7ef4359 sysctl: Pass useful parameters to sysctl permissions
- Current is implicitly avaiable so passing current->nsproxy isn't useful.
- The ctl_table_header is needed to find how the sysctl table is connected
  to the rest of sysctl.
- ctl_table_root is avaiable in the ctl_table_header so no need to it.

With these changes it becomes possible to write a version of
net_sysctl_permission that takes into account the network namespace of
the sysctl table, an important feature in extending the user namespace.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-11-18 20:30:55 -05:00
David Howells
607ca46e97 UAPI: (Scripted) Disintegrate include/linux
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
2012-10-13 10:46:48 +01:00
Eric W. Biederman
fea478d410 sysctl: Add register_sysctl for normal sysctl users
The plan is to convert all callers of register_sysctl_table
and register_sysctl_paths to register_sysctl.  The interface
to register_sysctl is enough nicer this should make the callers
a bit more readable.  Additionally after the conversion the
230 lines of backwards compatibility can be removed.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:30 -08:00
Eric W. Biederman
ac13ac6f4c sysctl: Index sysctl directories with rbtrees.
One of the most important jobs of sysctl is to export network stack
tunables.  Several of those tunables are per network device.  In
several instances people are running with 1000+ network devices in
there network stacks, which makes the simple per directory linked list
in sysctl a scaling bottleneck.   Replace O(N^2) sysctl insertion and
lookup times with O(NlogN) by using an rbtree to index the sysctl
directories.

Benchmark before:
    make-dummies 0 999 -> 0.32s
    rmmod dummy        -> 0.12s
    make-dummies 0 9999 -> 1m17s
    rmmod dummy         -> 17s

Benchmark after:
    make-dummies 0 999 -> 0.074s
    rmmod dummy        -> 0.070s
    make-dummies 0 9999 -> 3.4s
    rmmod dummy         -> 0.44s

Benchmark after (without dev_snmp6):
    make-dummies 0 9999 -> 0.75s
    rmmod dummy         -> 0.44s
    make-dummies 0 99999 -> 11s
    rmmod dummy          -> 4.3s

At 10,000 dummy devices the bottleneck becomes the time to add and
remove the files under /proc/sys/net/dev_snmp6.  I have commented
out the code that adds and removes files under /proc/sys/net/dev_snmp6
and taken measurments of creating and destroying 100,000 dummies to
verify the sysctl continues to scale.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:30 -08:00
Eric W. Biederman
9e3d47df35 sysctl: Make the header lists per directory.
Slightly enhance efficiency and clarity of the code by making the
header list per directory instead of per set.

Benchmark before:
    make-dummies 0 999 -> 0.63s
    rmmod dummy        -> 0.12s
    make-dummies 0 9999 -> 2m35s
    rmmod dummy         -> 18s

Benchmark after:
    make-dummies 0 999 -> 0.32s
    rmmod dummy        -> 0.12s
    make-dummies 0 9999 -> 1m17s
    rmmod dummy         -> 17s

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:30 -08:00
Eric W. Biederman
60a47a2e82 sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxy
An nsproxy argument here has always been awkard and now the nsproxy argument
is completely unnecessary so remove it, replacing it with the set we want
the registered tables to show up in.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:30 -08:00
Eric W. Biederman
0e47c99d7f sysctl: Replace root_list with links between sysctl_table_sets.
Piecing together directories by looking first in one directory
tree, than in another directory tree and finally in a third
directory tree makes it hard to verify that some directory
entries are not multiply defined and makes it hard to create
efficient implementations the sysctl filesystem.

Replace the sysctl wide list of roots with autogenerated
links from the core sysctl directory tree to the other
sysctl directory trees.

This simplifies sysctl directory reading and lookups as now
only entries in a single sysctl directory tree need to be
considered.

Benchmark before:
    make-dummies 0 999 -> 0.44s
    rmmod dummy        -> 0.065s
    make-dummies 0 9999 -> 1m36s
    rmmod dummy         -> 0.4s

Benchmark after:
    make-dummies 0 999 -> 0.63s
    rmmod dummy        -> 0.12s
    make-dummies 0 9999 -> 2m35s
    rmmod dummy         -> 18s

The slowdown is caused by the lookups used in insert_headers
and put_links to see if we need to add links or remove links.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:29 -08:00
Eric W. Biederman
7ec66d0636 sysctl: Stop requiring explicit management of sysctl directories
Simplify the code and the sysctl semantics by autogenerating
sysctl directories when a sysctl table is registered that needs
the directories and autodeleting the directories when there are
no more sysctl tables registered that need them.

Autogenerating directories keeps sysctl tables from depending
on each other, removing all of the arcane register/unregister
ordering constraints and makes it impossible to get the order
wrong when reigsering and unregistering sysctl tables.

Autogenerating directories yields one unique entity that dentries
can point to, retaining the current effective use of the dcache.

Add struct ctl_dir as the type of these new autogenerated
directories.

The attached_by and attached_to fields in ctl_table_header are
removed as they are no longer needed.

The child field in ctl_table is no longer needed by the core of
the sysctl code.  ctl_table.child can be removed once all of the
existing users have been updated.

Benchmark before:
    make-dummies 0 999 -> 0.7s
    rmmod dummy        -> 0.07s
    make-dummies 0 9999 -> 1m10s
    rmmod dummy         -> 0.4s

Benchmark after:
    make-dummies 0 999 -> 0.44s
    rmmod dummy        -> 0.065s
    make-dummies 0 9999 -> 1m36s
    rmmod dummy         -> 0.4s

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:29 -08:00
Eric W. Biederman
9eb47c26f0 sysctl: Add a root pointer to ctl_table_set
Add a ctl_table_root pointer to ctl_table set so it is easy to
go from a ctl_table_set to a ctl_table_root.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:29 -08:00
Eric W. Biederman
938aaa4f92 sysctl: Initial support for auto-unregistering sysctl tables.
Add nreg to ctl_table_header.  When nreg drops to 0 the ctl_table_header
will be unregistered.

Factor out drop_sysctl_table from unregister_sysctl_table, and add
the logic for decrementing nreg.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:28 -08:00
Eric W. Biederman
8d6ecfcc01 sysctl: Remove the now unused ctl_table parent field.
While useful at one time for selinux and the sysctl sanity
checks those users no longer use the parent field and we can
safely remove it.

Inspired-by: Lucian Adrian Grijincu <lucian.grijincu@gmil.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:28 -08:00
Eric W. Biederman
f728019bb7 sysctl: register only tables of sysctl files
Split the registration of a complex ctl_table array which may have
arbitrary numbers of directories (->child != NULL) and tables of files
into a series of simpler registrations that only register tables of files.

Graphically:

   register('dir', { + file-a
                     + file-b
                     + subdir1
                       + file-c
                     + subdir2
                       + file-d
                       + file-e })

is transformed into:
   wrapper->subheaders[0] = register('dir', {file1-a, file1-b})
   wrapper->subheaders[1] = register('dir/subdir1', {file-c})
   wrapper->subheaders[2] = register('dir/subdir2', {file-d, file-e})
   return wrapper

This guarantees that __register_sysctl_table will only see a simple
ctl_table array with all entries having (->child == NULL).

Care was taken to pass the original simple ctl_table arrays to
__register_sysctl_table whenever possible.

This change is derived from a similar patch written
by Lucrian Grijincu.

Inspired-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:40:27 -08:00
Eric W. Biederman
6e9d516415 sysctl: Add support for register sysctl tables with a normal cstring path.
Make __register_sysctl_table the core sysctl registration operation and
make it take a char * string as path.

Now that binary paths have been banished into the real of backwards
compatibility in kernel/binary_sysctl.c where they can be safely
ignored there is no longer a need to use struct ctl_path to represent
path names when registering ctl_tables.

Start the transition to using normal char * strings to represent
pathnames when registering sysctl tables.  Normal strings are easier
to deal with both in the internal sysctl implementation and for
programmers registering sysctl tables.

__register_sysctl_paths is turned into a backwards compatibility wrapper
that converts a ctl_path array into a normal char * string.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:55 -08:00
Eric W. Biederman
bd295b56cf sysctl: Remove the unnecessary sysctl_set parent concept.
In sysctl_net register the two networking roots in the proper order.

In register_sysctl walk the sysctl sets in the reverse order of the
sysctl roots.

Remove parent from ctl_table_set and setup_sysctl_set as it is no
longer needed.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:55 -08:00
Eric W. Biederman
97324cd804 sysctl: Implement retire_sysctl_set
This adds a small helper retire_sysctl_set to remove the intimate knowledge about
the how a sysctl_set is implemented from net/sysct_net.c

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:55 -08:00
Eric W. Biederman
1f87f0b52b sysctl: Move the implementation into fs/proc/proc_sysctl.c
Move the core sysctl code from kernel/sysctl.c and kernel/sysctl_check.c
into fs/proc/proc_sysctl.c.

Currently sysctl maintenance is hampered by the sysctl implementation
being split across 3 files with artificial layering between them.
Consolidate the entire sysctl implementation into 1 file so that
it is easier to see what is going on and hopefully allowing for
simpler maintenance.

For functions that are now only used in fs/proc/proc_sysctl.c remove
their declarations from sysctl.h and make them static in fs/proc/proc_sysctl.c

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:54 -08:00
Eric W. Biederman
de4e83bd6b sysctl: Register the base sysctl table like any other sysctl table.
Simplify the code by treating the base sysctl table like any other
sysctl table and register it with register_sysctl_table.

To ensure this table is registered early enough to avoid problems
call sysctl_init from proc_sys_init.

Rename sysctl_net.c:sysctl_init() to net_sysctl_init() to avoid
name conflicts now that kernel/sysctl.c:sysctl_init() is no longer
static.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:54 -08:00
Eric W. Biederman
0ce8974d50 sysctl: Consolidate !CONFIG_SYSCTL handling
- In sysctl.h move functions only available if CONFIG_SYSCL
  is defined inside of #ifdef CONFIG_SYSCTL

- Move the stub function definitions for !CONFIG_SYSCTL
  into sysctl.h and make them static inlines.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2012-01-24 16:37:54 -08:00
Al Viro
36fcb589e7 sysctl: use umode_t for table permissions
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-01-03 22:55:12 -05:00
Lucas De Marchi
f1ecf06854 sysctl: add support for poll()
Adding support for poll() in sysctl fs allows userspace to receive
notifications of changes in sysctl entries.  This adds a infrastructure to
allow files in sysctl fs to be pollable and implements it for hostname and
domainname.

[akpm@linux-foundation.org: s/declare/define/ for definitions]
Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Greg KH <gregkh@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 16:07:02 -07:00
Vasily Averin
349d2895cc ipv4: NET_IPV4_ROUTE_GC_INTERVAL removal
removing obsoleted sysctl,
ip_rt_gc_interval variable no longer used since 2.6.38

Signed-off-by: Vasily Averin <vvs@sw.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-10-03 14:13:01 -04:00
Stephen Rothwell
684adca4f8 sysctl: the include of rcupdate.h is only needed in the kernel
Fixes this build-check error:

  include/linux/sysctl.h:28: included file 'linux/rcupdate.h' is not exported

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-09 16:43:24 -08:00
Al Viro
dfef6dcd35 unfuck proc_sysctl ->d_compare()
a) struct inode is not going to be freed under ->d_compare();
however, the thing PROC_I(inode)->sysctl points to just might.
Fortunately, it's enough to make freeing that sucker delayed,
provided that we don't step on its ->unregistering, clear
the pointer to it in PROC_I(inode) before dropping the reference
and check if it's NULL in ->d_compare().

b) I'm not sure that we *can* walk into NULL inode here (we recheck
dentry->seq between verifying that it's still hashed / fetching
dentry->d_inode and passing it to ->d_compare() and there's no
negative hashed dentries in /proc/sys/*), but if we can walk into
that, we really should not have ->d_compare() return 0 on it!
Said that, I really suspect that this check can be simply killed.
Nick?

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-03-08 02:22:27 -05:00
Octavian Purdila
9f977fb7ae sysctl: add proc_do_large_bitmap
The new function can be used to read/write large bitmaps via /proc. A
comma separated range format is used for compact output and input
(e.g. 1,3-4,10-10).

Writing into the file will first reset the bitmap then update it
based on the given input.

Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-15 23:28:39 -07:00
Eric W. Biederman
54716e3beb net neigh: Decouple per interface neighbour table controls from binary sysctls
Stop computing the number of neighbour table settings we have by
counting the number of binary sysctls.  This behaviour was silly
and meant that we could not add another neighbour table setting
without also adding another binary sysctl.

Don't pass the binary sysctl path for neighour table entries
into neigh_sysctl_register.  These parameters are no longer
used and so are just dead code.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-16 15:55:18 -08:00
Eric W. Biederman
02291680ff net ipv4: Decouple ipv4 interface parameters from binary sysctl numbers
Stop using the binary sysctl enumeartion in sysctl.h as an index into
a per interface array.  This leads to unnecessary binary sysctl number
allocation, and a fragility in data structure and implementation
because of unnecessary coupling.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-16 15:55:17 -08:00
David S. Miller
d4a66e752d Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
	drivers/net/benet/be_cmds.h
	include/linux/sysctl.h
2010-01-10 22:55:03 -08:00
Jesper Dangaard Brouer
65324144b5 net: RFC3069, private VLAN proxy arp support
This is to be used together with switch technologies, like RFC3069,
that where the individual ports are not allowed to communicate with
each other, but they are allowed to talk to the upstream router.  As
described in RFC 3069, it is possible to allow these hosts to
communicate through the upstream router by proxy_arp'ing.

This patch basically allow proxy arp replies back to the same
interface (from which the ARP request/solicitation was received).

Tunable per device via proc "proxy_arp_pvlan":
  /proc/sys/net/ipv4/conf/*/proxy_arp_pvlan

This switch technology is known by different vendor names:
 - In RFC 3069 it is called VLAN Aggregation.
 - Cisco and Allied Telesyn call it Private VLAN.
 - Hewlett-Packard call it Source-Port filtering or port-isolation.
 - Ericsson call it MAC-Forced Forwarding (RFC Draft).

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-01-07 00:59:09 -08:00