From patchwork Fri Oct 16 23:09:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 11842451 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 106B717E6 for ; Fri, 16 Oct 2020 23:09:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA33522201 for ; Fri, 16 Oct 2020 23:09:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GEabQQbY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA33522201 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 5F5DC6B0072; Fri, 16 Oct 2020 19:09:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5AAF76B0073; Fri, 16 Oct 2020 19:09:48 -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 4BD4A6B0074; Fri, 16 Oct 2020 19:09:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 12C946B0072 for ; Fri, 16 Oct 2020 19:09:48 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id ABFDC362C for ; Fri, 16 Oct 2020 23:09:47 +0000 (UTC) X-FDA: 77379332814.18.grade73_0b0c68227220 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 910A710269E77 for ; Fri, 16 Oct 2020 23:09:47 +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:1513:1515:1521: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:14096:14181:14384:14721:21080:21444:21627:21740:30054,0,RBL:209.85.221.66:@google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yffxcmdrqquhcqdw3n5oo9m7yc5yp3rfdcx6ba3844f5eqza5jh5n8fwfp6cd.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: grade73_0b0c68227220 X-Filterd-Recvd-Size: 4737 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 16 Oct 2020 23:09:47 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id i1so4896081wro.1 for ; Fri, 16 Oct 2020 16:09:47 -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=gdMs/4BkKI2uJNTjUP69TVUzfQ5T9+m8xYXEzWMRNr4=; b=GEabQQbYPZdJBOj2BGbAAiir4cXarxTnRaOVXj4JRtZnmqkGa2CMArEAtTbi/+hATc B3cLhuNPZmMDZZJ86auETwNS7l/UKxN72uloxbt8mov62APgfpCPMibJZymXO2u+hfYY tWXoKpqkr2Qqiu4JCttGYfZAkH/ujpEvJ1ewfBPeR4HRYEvHCoGe/kRLeMDB/rCwR+td NMmO7SkZilT2N5jpR4yiruA6rC3UNfH7boHds7qX9AyQpG3q9B/gPQRxlhOAm08sEyOa 5WtVENVcOyUP7EBHec33EsP8pE9FjCvAdNR+mwZMFo//3lJ7WJyRClrGRBrrLRzn4e2R Z1Yg== 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=gdMs/4BkKI2uJNTjUP69TVUzfQ5T9+m8xYXEzWMRNr4=; b=f4pjndQFnD0WRUI7RNi6AcyLu4u+FQJat4jv/3CZcDE6G4sRgfZJS/9IjHkzwnExd7 6jQlqavRp+qP4YSnm5U84wqNQ0Hqj+XbwKdzFIclGLw+5hh0qOy1ixZmRuKTnrscK1Na rk8odGayRz2yg4jxeYMaUB1accC2m8RQ66DTrprjyAS8DEHKPYeBEDQ9bYaf3oP6Y5tb JHnnI1XQbMT7DZfqZMLnCvk8D9w1lF9poWI6dqh/vfN7OMQKswO1hQrI54LMXjok3Lzo C6bNDP4sJRmWNmXS6GDhoGCGza020oEf7BJT6l+AG52wd/RiRhn+0UWGrRjxInH5FIo8 Qpbw== X-Gm-Message-State: AOAM5334iDgFDwfhGCuFfK9XKVqawQzDM/hv+68EFFNQG1FBggiayosL S8OL0PcOat0XZf/fe5eNYu9jgQ== X-Google-Smtp-Source: ABdhPJxbfO8IUNwESku/fIzsOaLeXDX/vfAWxdZkmAezDlH0QNO6awB1LAUdwuJDWyVhjwRK4WO4nQ== X-Received: by 2002:adf:f810:: with SMTP id s16mr6374268wrp.424.1602889786072; Fri, 16 Oct 2020 16:09:46 -0700 (PDT) Received: from localhost ([2a02:168:96c5:1:55ed:514f:6ad7:5bcc]) by smtp.gmail.com with ESMTPSA id t19sm5148559wmi.26.2020.10.16.16.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 16:09:45 -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 resend 6/6] mm: remove now-unused mmdrop_async() Date: Sat, 17 Oct 2020 01:09:15 +0200 Message-Id: <20201016230915.1972840-7-jannh@google.com> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201016230915.1972840-1-jannh@google.com> References: <20201016230915.1972840-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);