From patchwork Thu Nov 11 09:50:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12614511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6DB1C433EF for ; Thu, 11 Nov 2021 09:50:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 726FF61107 for ; Thu, 11 Nov 2021 09:50:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 726FF61107 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EE1C26B009D; Thu, 11 Nov 2021 04:50:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E90F06B009F; Thu, 11 Nov 2021 04:50:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBD906B009E; Thu, 11 Nov 2021 04:50:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id A82726B009A for ; Thu, 11 Nov 2021 04:50:41 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 707E4184E6C76 for ; Thu, 11 Nov 2021 09:50:41 +0000 (UTC) X-FDA: 78796179882.16.C024F7C Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf04.hostedemail.com (Postfix) with ESMTP id 3C11450000BE for ; Thu, 11 Nov 2021 09:50:30 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AB9hqYu010225; Thu, 11 Nov 2021 09:50:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=FSi8nF5wttF33E9wgVxGAZhKsV5pV7mXAM/JTrIWIiw=; b=XTbXPemcoCtmj9JMsrGEOKtcltq8pDAbUgNQGg8GRbZ0zYw5kh5czV9IcNb0Xo/tFmHu uJAagHrMoWyuXhE6eFsU8a1xN10dQoe213CEAod5cL+Rtgv1WAAtZuN1vOsCuiIOuK4e j30hmD8fNqzWUbsB0cqOWTdaUNRloqmCFLdYxJeqD7JzoSGbEXxnZ+tIIFTyJyxyu4lV s+lTsswihh/sGl5KP/mdCDmASbIEEKhTPUOXwGbOmHWIYRl2i2B0aOX6EUnAfLED/qXL oMFC4Vw2Wdjmi4+UWRH38xn1rZAbi6VeSSnXBlraiGK+U4GBjY1LqRIqe06zciTs0vre Ag== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3c90t4r321-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Nov 2021 09:50:27 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1AB9i6ko011485; Thu, 11 Nov 2021 09:50:26 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3c90t4r310-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Nov 2021 09:50:26 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AB9m8Cc014429; Thu, 11 Nov 2021 09:50:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma02fra.de.ibm.com with ESMTP id 3c5hba1bm0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Nov 2021 09:50:23 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AB9oIXq48562634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Nov 2021 09:50:19 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B94E24C062; Thu, 11 Nov 2021 09:50:18 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8321B4C044; Thu, 11 Nov 2021 09:50:17 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.11.147]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 11 Nov 2021 09:50:17 +0000 (GMT) From: Claudio Imbrenda To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: thuth@redhat.com, frankja@linux.ibm.com, borntraeger@de.ibm.com, Ulrich.Weigand@de.ibm.com, heiko.carstens@de.ibm.com, david@redhat.com, ultrachin@163.com, akpm@linux-foundation.org, vbabka@suse.cz, brookxu.cn@gmail.com, xiaoggchen@tencent.com, linuszeng@tencent.com, yihuilu@tencent.com, mhocko@suse.com, daniel.m.jordan@oracle.com, axboe@kernel.dk, legion@kernel.org, peterz@infradead.org, aarcange@redhat.com, christian@brauner.io, ebiederm@xmission.com, tglx@linutronix.de Subject: [RFC v1 1/4] add arch mmput hook in exit.c Date: Thu, 11 Nov 2021 10:50:04 +0100 Message-Id: <20211111095008.264412-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111095008.264412-1-imbrenda@linux.ibm.com> References: <20211111095008.264412-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: m_TBdmzdzkkBHlViyl3rU8FuaNQuV6Yv X-Proofpoint-GUID: AP5XROjvqWy0OtQFPYwAfK001oy9Eiax X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-11_02,2021-11-08_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 mlxscore=0 impostorscore=0 bulkscore=0 mlxlogscore=855 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111110056 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3C11450000BE X-Stat-Signature: adqdybheg9w4y3gf3qi9mnez3idmusdg Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=XTbXPemc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.hostedemail.com: domain of imbrenda@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=imbrenda@linux.ibm.com X-HE-Tag: 1636624230-391167 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: This simple patch adds a hook for the mmput in exit_mm. This allows archs to perform the mmput in custom ways if desired (e.g. asynchronously) No functional change intended. Signed-off-by: Claudio Imbrenda --- include/asm-generic/mmu_context.h | 4 ++++ kernel/exit.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu_context.h index 91727065bacb..900931a6a105 100644 --- a/include/asm-generic/mmu_context.h +++ b/include/asm-generic/mmu_context.h @@ -73,4 +73,8 @@ static inline void deactivate_mm(struct task_struct *tsk, } #endif +#ifndef arch_exit_mm_mmput +#define arch_exit_mm_mmput mmput +#endif + #endif /* __ASM_GENERIC_MMU_CONTEXT_H */ diff --git a/kernel/exit.c b/kernel/exit.c index f702a6a63686..6eb1fdcc434e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -504,7 +504,7 @@ static void exit_mm(void) task_unlock(current); mmap_read_unlock(mm); mm_update_next_owner(mm); - mmput(mm); + arch_exit_mm_mmput(mm); if (test_thread_flag(TIF_MEMDIE)) exit_oom_victim(); }