The patch titled Subject: mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix has been added to the -mm tree. Its filename is mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Rientjes <rientjes@xxxxxxxxxx> Subject: mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix Move the check for !mm out of line as suggested by Andrew. Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memcontrol.h | 2 +- mm/memcontrol.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff -puN include/linux/memcontrol.h~mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix include/linux/memcontrol.h --- a/include/linux/memcontrol.h~mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix +++ a/include/linux/memcontrol.h @@ -188,7 +188,7 @@ void __mem_cgroup_count_vm_event(struct static inline void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) { - if (mem_cgroup_disabled() || !mm) + if (mem_cgroup_disabled()) return; __mem_cgroup_count_vm_event(mm, idx); } diff -puN mm/memcontrol.c~mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix mm/memcontrol.c --- a/mm/memcontrol.c~mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix +++ a/mm/memcontrol.c @@ -1156,6 +1156,9 @@ void __mem_cgroup_count_vm_event(struct { struct mem_cgroup *memcg; + if (!mm) + return; + rcu_read_lock(); memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); if (unlikely(!memcg)) _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are linux-next.patch x86-convert-update_mmu_cache-and-update_mmu_cache_pmd-to-functions.patch x86-fix-the-argument-passed-to-sync_global_pgds.patch irq-tsk-comm-is-an-array.patch mm-memcg-make-mem_cgroup_out_of_memory-static.patch mm-use-is_enabledconfig_numa-instead-of-numa_build.patch mm-use-is_enabledconfig_compaction-instead-of-compaction_build.patch thp-clean-up-__collapse_huge_page_isolate.patch memory-hotplug-suppress-device-memoryx-does-not-have-a-release-function-warning.patch memory-hotplug-skip-hwpoisoned-page-when-offlining-pages.patch memory-hotplug-update-mce_bad_pages-when-removing-the-memory.patch memory-hotplug-update-mce_bad_pages-when-removing-the-memory-fix.patch memory-hotplug-auto-offline-page_cgroup-when-onlining-memory-block-failed.patch memory-hotplug-fix-nr_free_pages-mismatch.patch numa-convert-static-memory-to-dynamically-allocated-memory-for-per-node-device.patch memory-hotplug-suppress-device-nodex-does-not-have-a-release-function-warning.patch memory-hotplug-mm-sparsec-clear-the-memory-to-store-struct-page.patch memory-hotplug-allocate-zones-pcp-before-onlining-pages.patch memory-hotplug-allocate-zones-pcp-before-onlining-pages-fix.patch memory-hotplug-allocate-zones-pcp-before-onlining-pages-fix-2.patch memory_hotplug-fix-possible-incorrect-node_states.patch slub-hotplug-ignore-unrelated-nodes-hot-adding-and-hot-removing.patch mm-oom-allow-exiting-threads-to-have-access-to-memory-reserves.patch memcg-make-it-possible-to-use-the-stock-for-more-than-one-page.patch memcg-reclaim-when-more-than-one-page-needed.patch memcg-change-defines-to-an-enum.patch memcg-kmem-accounting-basic-infrastructure.patch mm-add-a-__gfp_kmemcg-flag.patch memcg-kmem-controller-infrastructure.patch memcg-kmem-controller-infrastructure-replace-__always_inline-with-plain-inline.patch mm-allocate-kernel-pages-to-the-right-memcg.patch res_counter-return-amount-of-charges-after-res_counter_uncharge.patch memcg-kmem-accounting-lifecycle-management.patch memcg-use-static-branches-when-code-not-in-use.patch memcg-allow-a-memcg-with-kmem-charges-to-be-destructed.patch memcg-execute-the-whole-memcg-freeing-in-free_worker.patch fork-protect-architectures-where-thread_size-=-page_size-against-fork-bombs.patch memcg-add-documentation-about-the-kmem-controller.patch slab-slub-struct-memcg_params.patch slab-annotate-on-slab-caches-nodelist-locks.patch slab-slub-consider-a-memcg-parameter-in-kmem_create_cache.patch memcg-allocate-memory-for-memcg-caches-whenever-a-new-memcg-appears.patch memcg-allocate-memory-for-memcg-caches-whenever-a-new-memcg-appears-simplify-ida-initialization.patch memcg-infrastructure-to-match-an-allocation-to-the-right-cache.patch memcg-skip-memcg-kmem-allocations-in-specified-code-regions.patch memcg-skip-memcg-kmem-allocations-in-specified-code-regions-remove-test-for-current-mm-in-memcg_stop-resume_kmem_account.patch slb-always-get-the-cache-from-its-page-in-kmem_cache_free.patch slb-allocate-objects-from-memcg-cache.patch memcg-destroy-memcg-caches.patch memcg-destroy-memcg-caches-move-include-of-workqueueh-to-top-of-slabh-file.patch memcg-slb-track-all-the-memcg-children-of-a-kmem_cache.patch memcg-slb-shrink-dead-caches.patch memcg-slb-shrink-dead-caches-get-rid-of-once-per-second-cache-shrinking-for-dead-memcgs.patch memcg-aggregate-memcg-cache-values-in-slabinfo.patch slab-propagate-tunable-values.patch slub-slub-specific-propagation-changes.patch slub-slub-specific-propagation-changes-fix.patch kmem-add-slab-specific-documentation-about-the-kmem-controller.patch memcg-add-comments-clarifying-aspects-of-cache-attribute-propagation.patch slub-drop-mutex-before-deleting-sysfs-entry.patch mm-support-more-pagesizes-for-map_hugetlb-shm_hugetlb-v7-fix-fix-fix.patch mm-support-more-pagesizes-for-map_hugetlb-shm_hugetlb-v7-fix-fix-fix-fix.patch mm-support-more-pagesizes-for-map_hugetlb-shm_hugetlb-v7-fix-fix-fix-fix-checkpatch-fixes.patch mm-introduce-a-common-interface-for-balloon-pages-mobility-fix.patch mm-mempolicy-remove-duplicate-code.patch mm-cleanup-register_node.patch mm-oom-change-type-of-oom_score_adj-to-short.patch mm-oom-fix-race-when-specifying-a-thread-as-the-oom-origin.patch drivers-base-nodec-cleanup-node_state_attr.patch mm-memory-hotplug-dynamic-configure-movable-memory-and-portion-memory.patch memory_hotplug-handle-empty-zone-when-online_movable-online_kernel.patch memory_hotplug-ensure-every-online-node-has-normal-memory.patch thp-huge-zero-page-basic-preparation.patch thp-huge-zero-page-basic-preparation-v6.patch thp-zap_huge_pmd-zap-huge-zero-pmd.patch thp-copy_huge_pmd-copy-huge-zero-page.patch thp-copy_huge_pmd-copy-huge-zero-page-v6.patch thp-copy_huge_pmd-copy-huge-zero-page-v6-fix.patch thp-do_huge_pmd_wp_page-handle-huge-zero-page.patch thp-do_huge_pmd_wp_page-handle-huge-zero-page-v6.patch thp-change_huge_pmd-make-sure-we-dont-try-to-make-a-page-writable.patch thp-change-split_huge_page_pmd-interface.patch thp-change-split_huge_page_pmd-interface-v6.patch thp-implement-splitting-pmd-for-huge-zero-page.patch thp-implement-splitting-pmd-for-huge-zero-page-v6.patch thp-setup-huge-zero-page-on-non-write-page-fault.patch thp-setup-huge-zero-page-on-non-write-page-fault-fix.patch thp-lazy-huge-zero-page-allocation.patch thp-implement-refcounting-for-huge-zero-page.patch thp-vmstat-implement-hzp_alloc-and-hzp_alloc_failed-events.patch thp-vmstat-implement-hzp_alloc-and-hzp_alloc_failed-events-v6.patch thp-introduce-sysfs-knob-to-disable-huge-zero-page.patch thp-avoid-race-on-multiple-parallel-page-faults-to-the-same-page.patch node_states-introduce-n_memory.patch cpuset-use-n_memory-instead-n_high_memory.patch procfs-use-n_memory-instead-n_high_memory.patch memcontrol-use-n_memory-instead-n_high_memory.patch oom-use-n_memory-instead-n_high_memory.patch mmmigrate-use-n_memory-instead-n_high_memory.patch mempolicy-use-n_memory-instead-n_high_memory.patch hugetlb-use-n_memory-instead-n_high_memory.patch vmstat-use-n_memory-instead-n_high_memory.patch kthread-use-n_memory-instead-n_high_memory.patch init-use-n_memory-instead-n_high_memory.patch vmscan-use-n_memory-instead-n_high_memory.patch page_alloc-use-n_memory-instead-n_high_memory-change-the-node_states-initialization.patch hotplug-update-nodemasks-management.patch mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled.patch mm-memcg-avoid-unnecessary-function-call-when-memcg-is-disabled-fix.patch numa-add-config_movable_node-for-movable-dedicated-node.patch numa-add-config_movable_node-for-movable-dedicated-node-fix.patch memory_hotplug-allow-online-offline-memory-to-result-movable-node.patch mm-oom-cleanup-pagefault-oom-handler.patch mm-oom-remove-redundant-sleep-in-pagefault-oom-handler.patch mm-oom-remove-statically-defined-arch-functions-of-same-name.patch mm-introduce-new-field-managed_pages-to-struct-zone.patch mm-provide-more-accurate-estimation-of-pages-occupied-by-memmap.patch mm-provide-more-accurate-estimation-of-pages-occupied-by-memmap-fix.patch memcg-do-not-check-for-mm-in-mem_cgroup_count_vm_event-disabled.patch mm-dmapoolc-fix-null-dev-in-dma_pool_create.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html