The patch titled Subject: memcg-decrement-static-keys-at-real-destroy-time-v6-fix has been added to the -mm tree. Its filename is memcg-decrement-static-keys-at-real-destroy-time-v6-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: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: memcg-decrement-static-keys-at-real-destroy-time-v6-fix - move enum sock_flag_bits into sock.h - document enum sock_flag_bits - convert memcg_proto_active() and memcg_proto_activated() to test_bit() - redo tcp_update_limit() comment to 80 cols Cc: Glauber Costa <glommer@xxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Li Zefan <lizefan@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memcontrol.h | 5 ----- include/net/sock.h | 15 +++++++++++++-- net/ipv4/tcp_memcontrol.c | 30 +++++++++++++++--------------- 3 files changed, 28 insertions(+), 22 deletions(-) diff -puN include/linux/memcontrol.h~memcg-decrement-static-keys-at-real-destroy-time-v6-fix include/linux/memcontrol.h --- a/include/linux/memcontrol.h~memcg-decrement-static-keys-at-real-destroy-time-v6-fix +++ a/include/linux/memcontrol.h @@ -405,11 +405,6 @@ enum { OVER_LIMIT, }; -enum sock_flag_bits { - MEMCG_SOCK_ACTIVE, - MEMCG_SOCK_ACTIVATED, -}; - struct sock; #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM void sock_update_memcg(struct sock *sk); diff -puN include/net/sock.h~memcg-decrement-static-keys-at-real-destroy-time-v6-fix include/net/sock.h --- a/include/net/sock.h~memcg-decrement-static-keys-at-real-destroy-time-v6-fix +++ a/include/net/sock.h @@ -46,6 +46,7 @@ #include <linux/list_nulls.h> #include <linux/timer.h> #include <linux/cache.h> +#include <linux/bitops.h> #include <linux/lockdep.h> #include <linux/netdevice.h> #include <linux/skbuff.h> /* struct sk_buff */ @@ -921,6 +922,16 @@ struct proto { #endif }; +/* + * Bits in struct cg_proto.flags + */ +enum sock_flag_bits { + /* Currently active and new sockets should be assigned to cgroups */ + MEMCG_SOCK_ACTIVE, + /* It was ever activated; we must disarm static keys on destruction */ + MEMCG_SOCK_ACTIVATED, +}; + struct cg_proto { void (*enter_memory_pressure)(struct sock *sk); struct res_counter *memory_allocated; /* Current allocated memory. */ @@ -945,12 +956,12 @@ extern void proto_unregister(struct prot static inline bool memcg_proto_active(struct cg_proto *cg_proto) { - return cg_proto->flags & (1 << MEMCG_SOCK_ACTIVE); + return test_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); } static inline bool memcg_proto_activated(struct cg_proto *cg_proto) { - return cg_proto->flags & (1 << MEMCG_SOCK_ACTIVATED); + return test_bit(MEMCG_SOCK_ACTIVATED, &cg_proto->flags); } #ifdef SOCK_REFCNT_DEBUG diff -puN net/ipv4/tcp_memcontrol.c~memcg-decrement-static-keys-at-real-destroy-time-v6-fix net/ipv4/tcp_memcontrol.c --- a/net/ipv4/tcp_memcontrol.c~memcg-decrement-static-keys-at-real-destroy-time-v6-fix +++ a/net/ipv4/tcp_memcontrol.c @@ -108,24 +108,24 @@ static int tcp_update_limit(struct mem_c clear_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); else if (val != RESOURCE_MAX) { /* - * The active bit needs to be written after the static_key update. - * This is what guarantees that the socket activation function - * is the last one to run. See sock_update_memcg() for details, - * and note that we don't mark any socket as belonging to this - * memcg until that flag is up. + * The active bit needs to be written after the static_key + * update. This is what guarantees that the socket activation + * function is the last one to run. See sock_update_memcg() for + * details, and note that we don't mark any socket as belonging + * to this memcg until that flag is up. * - * We need to do this, because static_keys will span multiple - * sites, but we can't control their order. If we mark a socket - * as accounted, but the accounting functions are not patched in - * yet, we'll lose accounting. + * We need to do this, because static_keys will span multiple + * sites, but we can't control their order. If we mark a socket + * as accounted, but the accounting functions are not patched in + * yet, we'll lose accounting. * - * We never race with the readers in sock_update_memcg(), because - * when this value change, the code to process it is not patched in - * yet. + * We never race with the readers in sock_update_memcg(), + * because when this value change, the code to process it is not + * patched in yet. * - * The activated bit is used to guarantee that no two writers will - * do the update in the same memcg. Without that, we can't properly - * shutdown the static key. + * The activated bit is used to guarantee that no two writers + * will do the update in the same memcg. Without that, we can't + * properly shutdown the static key. */ if (!test_and_set_bit(MEMCG_SOCK_ACTIVATED, &cg_proto->flags)) static_key_slow_inc(&memcg_socket_limit_enabled); _ Subject: Subject: memcg-decrement-static-keys-at-real-destroy-time-v6-fix Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are origin.patch linux-next.patch i-need-old-gcc.patch arch-alpha-kernel-systblss-remove-debug-check.patch drivers-block-nvmec-stop-breaking-my-i386-build.patch drivers-staging-zsmalloc-zsmalloc-mainc-unbork.patch arch-x86-platform-iris-irisc-register-a-platform-device-and-a-platform-driver.patch thermal-add-generic-cpufreq-cooling-implementation-fix.patch thermal-exynos5-add-exynos5-thermal-sensor-driver-support-fix.patch thermal-exynos-register-the-tmu-sensor-with-the-kernel-thermal-layer-fix.patch fs-symlink-restrictions-on-sticky-directories.patch fs-hardlink-creation-restrictions.patch mm.patch hugetlb-use-mmu_gather-instead-of-a-temporary-linked-list-for-accumulating-pages-fix.patch hugetlb-use-mmu_gather-instead-of-a-temporary-linked-list-for-accumulating-pages-fix-fix.patch memcg-add-hugetlb-extension-fix-fix.patch hugetlbfs-add-memcg-control-files-for-hugetlbfs-use-scnprintf-instead-of-sprintf-fix.patch memcg-move-hugetlb-resource-count-to-parent-cgroup-on-memcg-removal-fix.patch memcg-move-hugetlb-resource-count-to-parent-cgroup-on-memcg-removal-fix-fix.patch hugetlb-migrate-memcg-info-from-oldpage-to-new-page-during-migration-fix.patch mm-mmapc-find_vma-remove-unnecessary-ifmm-check-fix.patch mm-correctly-synchronize-rss-counters-at-exit-exec.patch mm-do_migrate_pages-calls-migrate_to_node-even-if-task-is-already-on-a-correct-node-fix.patch mm-do_migrate_pages-rename-arguments.patch mm-memcg-count-pte-references-from-every-member-of-the-reclaimed-hierarchy-fix.patch mm-rename-is_mlocked_vma-to-mlocked_vma_newpage-fix.patch mm-page_allocc-remove-pageblock_default_order.patch mm-remove-sparsemem-allocation-details-from-the-bootmem-allocator-fix.patch mm-page_allocc-cleanups.patch mm-push-lru-index-into-shrink_active_list-fix.patch memcg-fix-error-code-in-hugetlb_force_memcg_empty-v2-checkpatch-fixes.patch mm-memcg-print-statistics-from-live-counters-checkpatch-fixes.patch memcg-always-free-struct-memcg-through-schedule_work-fix.patch memcg-decrement-static-keys-at-real-destroy-time-v6-fix.patch security-keys-keyctlc-suppress-memory-allocation-failure-warning.patch isdn-add-missing-kern_cont-fix.patch nmi-watchdog-fix-for-lockup-detector-breakage-on-resume-fix.patch nmi-watchdog-fix-for-lockup-detector-breakage-on-resume-fix-fix.patch nmi-watchdog-fix-for-lockup-detector-breakage-on-resume-v2-fix.patch kernel-irq-managec-use-the-pr_foo-infrastructure-to-prefix-printks.patch vsprintf-correctly-handle-width-when-flag-used-in-%p-format-checkpatch-fixes.patch vsprintf-further-optimize-decimal-conversion-checkpatch-fixes.patch drivers-video-backlight-apple_blc-include-header-for-exported-symbol-prototypes-fix.patch backlight-add-lm3533-backlight-driver-fix.patch backlight-add-lm3533-backlight-driver-fix-fix.patch backlight-use-pr_warn-and-pr_debug-instead-of-printk-fix.patch backlight-apple_bl-use-pr_debug-pr_err-instead-of-printk-fix.patch backlight-cr_bllcd-use-pr_err-pr_info-instead-of-printk-fix.patch backlight-generic_bl-use-pr_info-instead-of-printk-fix.patch backlight-jornada720-use-pr_err-pr_info-instead-of-printk-fix.patch backlight-omap1-use-pr_info-instead-of-printk-fix.patch backlight-progear-use-pr_err-instead-of-printk-fix.patch leds-led-module-for-da9052-53-pmic-v2-fix.patch leds-add-led-driver-for-lm3556-chip-checkpatch-fixes.patch leds-add-led-driver-for-lm3556-chip-fix-fix.patch leds-heartbeat-stop-on-shutdown-checkpatch-fixes.patch drivers-leds-leds-pca955xc-fix-race-condition-while-setting-brightness-on-several-leds-fix.patch lib-string_helpersc-make-arrays-static.patch lib-bitmapc-fix-documentation-for-scnprintf-functions.patch rtc-rename-config_rtc_mxc-to-config_rtc_drv_mxc-fix.patch kmod-avoid-deadlock-by-recursive-kmod-call.patch proc-clean-up-proc-pid-environ-handling-checkpatch-fixes.patch kernel-cpuc-document-clear_tasks_mm_cpumask.patch kernel-cpuc-document-clear_tasks_mm_cpumask-fix.patch ipc-mqueue-improve-performance-of-send-recv-fix.patch ipc-mqueue-correct-mq_attr_ok-test-fix.patch ipc-mqueue-strengthen-checks-on-mqueue-creation-fix.patch tools-selftests-add-mq_perf_tests-checkpatch-fixes.patch ipc-mqueue-add-rbtree-node-caching-support-checkpatch-fixes.patch pidns-make-killed-children-autoreap-checkpatch-fixes.patch pidns-guarantee-that-the-pidns-init-will-be-the-last-pidns-process-reaped-v2-fix.patch fs-nls-add-apple-nls-fix.patch eventfd-change-int-to-__u64-in-eventfd_signal-fix.patch syscalls-x86-add-__nr_kcmp-syscall-v8.patch syscalls-x86-add-__nr_kcmp-syscall-v8-comment-update-fix.patch c-r-prctl-simplify-pr_set_mm-on-mm-code-data-assignment-fix.patch c-r-prctl-add-ability-to-get-clear_tid_address.patch notify_change-check-that-i_mutex-is-held.patch journal_add_journal_head-debug.patch mutex-subsystem-synchro-test-module-fix.patch slab-leaks3-default-y.patch put_bh-debug.patch linux-next-git-rejects.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