Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp193115ybg; Tue, 28 Jul 2020 03:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY7MCTvbl9Io0jM7kdxCkThIHe69qqXS62r7r7G0pMsR0ILGUPil6GPNU4Xj5QGNqEMm3G X-Received: by 2002:a50:a125:: with SMTP id 34mr25534414edj.306.1595932694540; Tue, 28 Jul 2020 03:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595932694; cv=none; d=google.com; s=arc-20160816; b=fae3kbFCifIpoYYk19h3PxoShEHXTFdZhzWG1DntEv+4uAHVGaExY9EUAjj0+U0fs1 bbmmeecZWfNA9WXtVKXQyBdhIjRUIATKJ+FWFVFjcpefgoOgnSaZPRYCdfEwyjuYbT7e OoTereW6G+T39ztaKI+xuS5TcT3DBI1XKfDb1Md0m5/oruP6xwBCUokcT6RRrnsIyd7K sNSwKeAzXKFgtvVTEZhaDdM9aAb7uf0eJ9x6iMD0j55oqp2Up29LG6e5dFUMd9c9ejyW x71fxcFrznYBbz4JAhccWUei7Qi7LDjmW4MMq3ayB7J2Y1ahQkOWKQzS0Qsm2bFM03hL 1iUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=5++a4qUoGvTtmbS8cBbdYfFdi2BqF+dka2SzgddlKxI=; b=b9dfi8lBren8Z5//E8vggKBs5FH/6SMXjO4y25qT9OCx2UxNJ775h0NsllE1/Kkk49 npM6P8xIrpHqMrtnfJcTPq2Ns+ElDU6IW5buc+OBfSOvceDv9fkZNxE5hmbky3VYRUrS chFid808FRT8JjkVJ1jvxExZlC3o6CZX0iuRaduKze7d+VzrNnkpurmFE7jebx5NNXKv rHZEsVlgb0OR0arn1ggpY2NVRB3uo2GblrHGyuoDn6HzeI9aCdF+G0ffmEQb0mtke8EF OYEa2qUZMDC6q2Jxn6cA3faQIg4mG0kpU+Ft7PZ2c1APkmE1g2JDMSLNj6N9U7Y0Au35 FDYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="reUkHy/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si7390594eds.485.2020.07.28.03.37.51; Tue, 28 Jul 2020 03:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="reUkHy/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbgG1Khm (ORCPT + 99 others); Tue, 28 Jul 2020 06:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728580AbgG1Khl (ORCPT ); Tue, 28 Jul 2020 06:37:41 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A18CC061794; Tue, 28 Jul 2020 03:37:41 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id d1so9663158plr.8; Tue, 28 Jul 2020 03:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=5++a4qUoGvTtmbS8cBbdYfFdi2BqF+dka2SzgddlKxI=; b=reUkHy/upDbi7FrzED0Yyk31NO19ZwYH83HIqIY7wQwbr3E4ahJNvkEJNa4WDNMcD0 6q66usnWreJz0RKRzJCtHjN/C+VbRWC/gYcAjYB7jznoR5c3xtCqGvCllJhroqxrWEK8 WU0ktdcGCI9+ujV6pdxUITAu6o5prhxZ/T3kLUzdo1Bw+kJ7QyEBMu/yyCZujHpwR1Gk lugSa9uEIHuJ3n/VO7PV5MisQt4bHQ6Oc5T+KAPYfhZSHq1+VBpmpDelpeo9HsM2E+yZ tG/gLwi3Y4Ooxoguret5gRQKA4VLZMVMkyYBHthlIreQxOaQViK8XL0sc/khjVM2/P6G vgpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=5++a4qUoGvTtmbS8cBbdYfFdi2BqF+dka2SzgddlKxI=; b=hybbwWH0bbVnQDRFk+8udA39PdA5bYp2kP2juXjiKAZHfD+V2z8gB040cuErSBIUu2 D8Li1DlIE2m3yasgSkEueFlkKLjjuZxgfXpsLUklj+8cVYqMbnNR5n5inNU0259iBOzc d2Kh2k8UpY+szNOWcTlJLEa+IOWgJeEjdh7q1Thalc/M/yu1bysPaujCTmSg8XVHZaez lBxyl7rSRUAOks/DHqMci82MSimoDtpAJJki6nPy1etl9gxtvHk5G98puRFObBIc9LBg LMyLV0JJHsyvXWjA8mRDUCcFmGAZbJmpkkeCTyAEejGKJm1Tzhz605jKFNoyUA4j2WTM IK7g== X-Gm-Message-State: AOAM532qM+qURwSWqc2nb+74fmbPhh22V+mvwmMMcbWRZdqDKwc3Mc+9 fKCIP10sLtrGjxEzWm2utxnJL2C8 X-Received: by 2002:a17:90a:6946:: with SMTP id j6mr3340756pjm.223.1595932660968; Tue, 28 Jul 2020 03:37:40 -0700 (PDT) Received: from localhost (110-174-173-27.tpgi.com.au. [110.174.173.27]) by smtp.gmail.com with ESMTPSA id x8sm5987747pfp.101.2020.07.28.03.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 03:37:40 -0700 (PDT) Date: Tue, 28 Jul 2020 20:37:34 +1000 From: Nicholas Piggin Subject: Re: [PATCH 01/24] asm-generic: add generic versions of mmu context functions To: "linux-arch@vger.kernel.org" , Vineet Gupta Cc: Arnd Bergmann , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" References: <20200728033405.78469-1-npiggin@gmail.com> <20200728033405.78469-2-npiggin@gmail.com> <12ac3789-71a5-2756-6a9e-769302c7b3c6@synopsys.com> In-Reply-To: <12ac3789-71a5-2756-6a9e-769302c7b3c6@synopsys.com> MIME-Version: 1.0 Message-Id: <1595931748.6mal1nph7g.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Vineet Gupta's message of July 28, 2020 2:01 pm: > On 7/27/20 8:33 PM, Nicholas Piggin wrote: >> Many of these are no-ops on many architectures, so extend mmu_context.h >> to cover MMU and NOMMU, and split the NOMMU bits out to nommu_context.h >>=20 >=20 >> -static inline void switch_mm(struct mm_struct *prev, >> - struct mm_struct *next, >> - struct task_struct *tsk) >> +/** >> + * activate_mm - called after exec switches the current task to a new m= m, to switch to it >> + * @prev_mm: previous mm of this task >> + * @next_mm: new mm >> + */ >> +#ifndef activate_mm >> +static inline void activate_mm(struct mm_struct *prev_mm, >> + struct mm_struct *next_mm) >> { >> + switch_mm(prev_mm, next_mm, current); >> } >> +#endif >=20 > Is activate_mm() really needed now. It seems most arches have > activate_mm(p, n) -> switch_mm(p, n, NULL) >=20 > And if we are passing current, that can be pushed inside switch_mm() Thanks for taking a look, I think there may be more consolidation like this possible, and certainly some of the arch patches could have gone a bit further. I wanted to be fairly careful to make only quite trivial changes (only the obvious no-ops) for the first iteration, but once this is in the tree it should become a fair bit easier to do some of your suggestions. There's a few things that make activate_mm->switch_mm not quite simple - alpha, nios2, parisc, s390, maybe x86. Thanks, Nick