From patchwork Fri Oct 16 02:40:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 11840503 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 795AC14B4 for ; Fri, 16 Oct 2020 02:40:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 356B22087D for ; Fri, 16 Oct 2020 02:40:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="UzPVodG7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 356B22087D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C264994000D; Thu, 15 Oct 2020 22:40:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BD5FD900002; Thu, 15 Oct 2020 22:40:44 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A288B94000D; Thu, 15 Oct 2020 22:40:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 750CB900002 for ; Thu, 15 Oct 2020 22:40:44 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0FE3A1EE6 for ; Fri, 16 Oct 2020 02:40:44 +0000 (UTC) X-FDA: 77376235608.06.grain72_030470127219 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id E4B0B10247F4E for ; Fri, 16 Oct 2020 02:40:43 +0000 (UTC) X-Spam-Summary: 1,0,0,979ee92b861f1a21,d41d8cd98f00b204,jannh@google.com,,RULES_HIT:41:69:355:379:541:800:960:966:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3866:3870:3871:3872:3874:4321:4385:4605:5007:6120:6261:6653:7903:9592:9969:10004:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:12986:13069:13161:13180:13229:13311:13357:13894:14096:14181:14384:14721:21080:21444:21627:21740:30054,0,RBL:209.85.128.65:@google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04y83g4fepnr7hx94mdr8wcixt4qpop3rfdcx6ba3844f5eqza5jh5n8fwfp6cd.bpbxa91xqchsrfbqwaq1k9w4tsf8n9iwqaourcabkpq6unadjg7wqbwo8p6ext8.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: grain72_030470127219 X-Filterd-Recvd-Size: 4716 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Fri, 16 Oct 2020 02:40:43 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id f21so946041wml.3 for ; Thu, 15 Oct 2020 19:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MM4vknTStYRLkGZw4tEHhTyBDfVUaCowXRmIC2TIp+c=; b=UzPVodG7vA2ic1HH1rFJ9ZFcjIcafLiynej1hsfsW7Kk8wfH5gNDzFpgzEjh3lN58l k0dAp9bXU+cG3pzw3tHSGbuYEk2L7mtIYHUFm+JeveAYlOMp75+XCbhV8IOZtonrBENQ N3EuUEXsABr3wvBaELeeMCVuFKi/re3WS+eoQMSP1pOGXHnkEyafFQENqCfVkz8ZBh12 LEr/np5tTIRUXaDrf3a6Zu5AOPiFCvfr+ogI139Xbc2dsROxhWd1zDR87GC3eWDxiU15 Mgm+yz3mfYc2ggE+SKeJcFy7gWvizCM5fduQMpvrjIhdvXokKcUaTd0xrhi19exO0wq1 CZQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MM4vknTStYRLkGZw4tEHhTyBDfVUaCowXRmIC2TIp+c=; b=UTNXdPAUEPBDFJUm0M+A4cRO2oW9WV1YS96iHzt+ggU6p5ONS59f2smdrRIlOCgHrY tbITnFQSb8Ew30VqzOipU6LimFSrGUzZiBJQFpRsgQhzYMf1QjmcW5qKD900es5848BD HQVBkMhD84POpULfRFGu3Avf8olI3UAoWXgbIvWh/DJ9F0n2+bTNBk56tpKS6dGbnUUj G7CB7hBVRCoXvvs9l49v9K4sleedO1ieXfMYabOjlG1uvp2zRuuHuMoDa14iRPB/CdnF CxcQhPCTaMfozX/x9sApaUU7CgN1ZaQg8q3+4DrqJQBNZ41R5LlOzVAvHGvWNl0yusMn to5w== X-Gm-Message-State: AOAM532azoKWyqE3vvHXAos5bqAvbCUmUvobNYowKEOrH53M/eUNKqw7 S+5NWJzEKovuin/tnhmSdfIsAbUn/epB/A== X-Google-Smtp-Source: ABdhPJzhEFMFksHr3z4YKmc2OKnKI/GGyeg8SX7OdlCeHKjZMM8NAVXhzJhEFVJQFXw7prbPniY0DA== X-Received: by 2002:a7b:c451:: with SMTP id l17mr1421587wmi.127.1602816042197; Thu, 15 Oct 2020 19:40:42 -0700 (PDT) Received: from localhost ([2a02:168:96c5:1:55ed:514f:6ad7:5bcc]) by smtp.gmail.com with ESMTPSA id p9sm990595wma.12.2020.10.15.19.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 19:40:41 -0700 (PDT) From: Jann Horn To: Andrew Morton , linux-mm@kvack.org, Eric Biederman , Oleg Nesterov Cc: linux-kernel@vger.kernel.org, Will Deacon , Kees Cook , Ingo Molnar Subject: [RFC PATCH 6/6] mm: remove now-unused mmdrop_async() Date: Fri, 16 Oct 2020 04:40:19 +0200 Message-Id: <20201016024019.1882062-7-jannh@google.com> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201016024019.1882062-1-jannh@google.com> References: <20201016024019.1882062-1-jannh@google.com> MIME-Version: 1.0 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: The preceding patches have removed all users of mmdrop_async(); get rid of it. Note that on MMU, we still need async_put_work because mmput_async() uses it, which in turn is used by binder's shrinker callback. We could claw back those 4 words per mm if we made mmput_async() depend on CONFIG_ANDROID_BINDER_IPC. Signed-off-by: Jann Horn --- include/linux/mm_types.h | 2 ++ kernel/fork.c | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 764d251966c7..8fde2068bde1 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -560,7 +560,9 @@ struct mm_struct { #ifdef CONFIG_HUGETLB_PAGE atomic_long_t hugetlb_usage; #endif +#ifdef CONFIG_MMU struct work_struct async_put_work; +#endif } __randomize_layout; /* diff --git a/kernel/fork.c b/kernel/fork.c index 4383bf055b40..c5f2ec544933 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -666,22 +666,6 @@ void __mmdrop(struct mm_struct *mm) } EXPORT_SYMBOL_GPL(__mmdrop); -static void mmdrop_async_fn(struct work_struct *work) -{ - struct mm_struct *mm; - - mm = container_of(work, struct mm_struct, async_put_work); - __mmdrop(mm); -} - -static void mmdrop_async(struct mm_struct *mm) -{ - if (unlikely(atomic_dec_and_test(&mm->mm_count))) { - INIT_WORK(&mm->async_put_work, mmdrop_async_fn); - schedule_work(&mm->async_put_work); - } -} - static inline void free_signal_struct(struct signal_struct *sig) { taskstats_tgid_free(sig);