Message ID | 20230727080502.77895-2-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 380D5C04E69 for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:06:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEC016B0080; Thu, 27 Jul 2023 04:06:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9C616B0081; Thu, 27 Jul 2023 04:06:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3C656B0082; Thu, 27 Jul 2023 04:06:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A26056B0080 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:06:03 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4B60F1401A4 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:06:03 +0000 (UTC) X-FDA: 81056658606.05.6818D0A Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf02.hostedemail.com (Postfix) with ESMTP id 4E8C380022 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:06:01 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=bWsdCjXI; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690445161; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CmSKD1W4o1llBpukOwDAPdWOg+LYzWoL67ya0UPwqvg=; b=7w2r35+/MKPTp3VyzSvngKhWUIF7Mc3iT3pEV5ikRKSae+L9qJ8gzvSKMGqKte4F+PqwgQ 4M7yb3R2pePP8phoZ7EPt2PijnQo7n0vPcNBE1uiA7WzHQS28/ZnV+tniADhSOUngCLmN3 NE27XoiCbeyVBbWire169osSCoibFUk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=bWsdCjXI; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445161; a=rsa-sha256; cv=none; b=vVwTQrKiuxmDnj8hPp798o4VC9HjoyLRPIn2P3AEZ6DhonwFTjRlSss7YhBBMadoyLNqzc YBdG/tEjgu0EANvCdjxT8BnFP7YdDBq8431M35dstCugcQ1uHJ+kehVj2hLeN6gIl7cK50 NdUdH8QzNbjgEKloLqKO5BKOWlIDBHA= Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-686f6231bdeso112247b3a.1 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445160; x=1691049960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CmSKD1W4o1llBpukOwDAPdWOg+LYzWoL67ya0UPwqvg=; b=bWsdCjXI/QTCbfrXnl1D1RHs1UzV532bO1xy0F2QKWdmxdeZNg1bc8fwYppoEa2Sii fv3Dw05OLiEoJFGdDqA0cK2BR0yissZW0QGh0p8G2jYOCo1VM3qmhhRKOuDu3Ld44+HC IlU/6E6PL7OGmulpkRgvQIFGvR7K7vSKmFATJlzNsM5VU0kfb+Q9ux9XLDln9HSGLjNa erFo50JbYYva+gdlhuASAFmcGCxJk1UklUElA3OcQq/NsulVXFSALP8x8A3jEL8k5O2s pAuqLDXkBW250K5e8xHlcez81V5k+DmAOms7sfdEUrryxL8JhS9LUOK5EJtF0pDaEYI9 8JWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445160; x=1691049960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CmSKD1W4o1llBpukOwDAPdWOg+LYzWoL67ya0UPwqvg=; b=AtHOQP3wMOcRS3acLn6hGmNl3x3FR6NZ6rJJ5/AsuofZ7fDn1s8a4SICvIPhNFoEdl PdLHcwGnTXpA0C6p61+aDgUwJby9yN4wntX8sYiDa9d1oF09tYInQOw8YLUj4Q2OFMa3 uVsVRfIZGubrzsrBHygu/6V5X5RstmihPHjsqSZNC6hiCFoPsBD44gX6w/brUJtMifzr bxIIcEtU09o0qYoU0+qL2RdpSg9OBWAe0d8772wl3AsEX3NvLt+fS1FcSXqx2GgFzeQd XNpBYu60xnWSz7EEzsdFcRMqSUJ/eGUNd4skHsszmKF8m3A8MJLnrb08vU6n+MUTGNkq eiXA== X-Gm-Message-State: ABy/qLb2TvjBoLE8KIiwggKXDDnMcxnmXp8q/f+MUSpeq+ToUW4jFvFx 5ZsGGbT3M7UWTaA5rLaQfMK+QA== X-Google-Smtp-Source: APBJJlGsBl3klUilUFzaktHEHOMbkNlcOB/1K8g6HjcIbYlgfdxi92AgDTolw1HjCRkDLU6/tzA6hQ== X-Received: by 2002:a05:6a21:78a8:b0:137:3eba:b81f with SMTP id bf40-20020a056a2178a800b001373ebab81fmr6002609pzc.3.1690445159927; Thu, 27 Jul 2023 01:05:59 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id j8-20020aa78d08000000b006828e49c04csm885872pfe.75.2023.07.27.01.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:05:59 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mtd@lists.infradead.org, rcu@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, Carlos Llamas <cmllamas@google.com> Subject: [PATCH v3 01/49] binder: fix memory leak in binder_init() Date: Thu, 27 Jul 2023 16:04:14 +0800 Message-Id: <20230727080502.77895-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230727080502.77895-1-zhengqi.arch@bytedance.com> References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4E8C380022 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: wo4yike1d1jmdanchedrto5ft6cb9pib X-HE-Tag: 1690445161-795311 X-HE-Meta: U2FsdGVkX18g/cv+jn/mFJSzGRllXaPoE0M+GFAhagRG8/+ehlLbrKpr4+dNRvArmozV0CQUlOy9z6Ddpgntjq2Mtr+bY7ZkLVJQDrBisAr1twIHJzso2vhrBxTWQ/WxVH98StZ0p3u3u3Vt12mcZeLMQ7Ts2OFNdcL+AlPh59J66c0MCLYl4KTkLrT+1pJVdjOq4XrTJgKmYCWp2jMvimNV4zL+m6BUwwUIRFIGsYzACgYTRgaNcddZMGvBW4Ak+jO9y0gZmmoCERAR8PtlApJ1EINLy/RuukyoY14OoVG7Ata6D7qFg4NpKI6B99MjOSeBkbqfbvd2rj9vKji06vPebEVFKesUiIN2Xwls8BuFEuxAXh6GynTS/1037n4D6xQm7a3p3m9o73GyOd5sbLx55LtHX8zCxad4pIL75Rd8h/684vlnoQoAaA4hYGMR1uaRsDExpUsaauODSut7e63kKXDA7XPx1b3kAdHcJ8c6b5D+5PC6x3PhwagOX/ycRS+Hl1l13ZY8/1dWkruOYVlfoF0wq9z22Rp9MXaGeDmpLxyES/O+RsaOsdRDuVjBDGkkssKaOQwhKIcrx3k/8o03wkE60F8Cf9U/M76dCpNTWhC4/CxbRHViZN+bLz52zme4fgd+PN838MLh3zJmvCvRcI2T2lzinNG8sN5awrLF7w54hMP60boP+Kga6dRoHg0z9TD5KWaK1bFdbSf4xmU5ps81TjqjaGCRzlTnWbI2HVaBiqd/w2uaABEpR/iUS/OjTxgzZ7wEds+dbk4vPSX6BxKEUK03jYRLYh37tHlfR7p3BkJsgFttcpnD9t/D5xeuGn+KQM22tbzAdfnEspkgbfI0WQ3uHyZWwjeIestS+M/VZFS4AFiWItiv+keUf+D+xureFI6OX5+WwpbF77ILb30lQ72PYfWSP85W0PT2XbekHM5K2gIVNhVnn7e6FUP5ozyw7vFOiklBEZ7 Lq/OcNxt qoNdmcxuHsoM1qdQuy77qNBEqxQVtrBZ3Z8mPHb4U9MqhrVQ8aaRwljevAchqLlA0Zae1DlHqi0iKNuVPyLPxHX+X+YLm/iPWo0g/d6PqaEW4qrrrhT/zU0X7Kj/plOU4UWqOPAChxrRV0eRAw658bGB3rx6uZofOOlpEVkMhH+3IxFnwBNoMQonsDPR5fKz/4GnMkfHAlvC5+BZnIvg4H0cXd5jLRsj2znaaRdTgzg3nj0YlfhloagObplz/b3tBopNEpz7TU/RAZqXsY8De48lYk8Lkad7Qr3O2ud9WZCUpC2mL4MCjAeQ54aFwmcoeGp1WW1FWufwH0iP/1gQO56CT+sI1csytW1EhO53LmCisLOdbZ6c60r5Bda4QzZI5NZWEtE/rRcBxHryNWGXduGGiG+4ne4qzx66gn10YpJ+zit4TW5WoDLjFKXMl57uinIxjMuix1EW9wpRo4Jr1JjcH6llJeHaew9hEO6HbPHK9b9o= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
use refcount+RCU method to implement lockless slab shrink
|
expand
|
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 486c8271cab7..d720f93d8b19 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -6617,6 +6617,7 @@ static int __init binder_init(void) err_alloc_device_names_failed: debugfs_remove_recursive(binder_debugfs_dir_entry_root); + binder_alloc_shrinker_exit(); return ret; } diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 662a2a2e2e84..e3db8297095a 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -1087,6 +1087,12 @@ int binder_alloc_shrinker_init(void) return ret; } +void binder_alloc_shrinker_exit(void) +{ + unregister_shrinker(&binder_shrinker); + list_lru_destroy(&binder_alloc_lru); +} + /** * check_buffer() - verify that buffer/offset is safe to access * @alloc: binder_alloc for this proc diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h index 138d1d5af9ce..dc1e2b01dd64 100644 --- a/drivers/android/binder_alloc.h +++ b/drivers/android/binder_alloc.h @@ -129,6 +129,7 @@ extern struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc, int pid); extern void binder_alloc_init(struct binder_alloc *alloc); extern int binder_alloc_shrinker_init(void); +extern void binder_alloc_shrinker_exit(void); extern void binder_alloc_vma_close(struct binder_alloc *alloc); extern struct binder_buffer * binder_alloc_prepare_to_free(struct binder_alloc *alloc,