From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AC5AC433E1 for ; Tue, 28 Jul 2020 10:37:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF35F20786 for ; Tue, 28 Jul 2020 10:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="reUkHy/u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF35F20786 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 244B78D0006; Tue, 28 Jul 2020 06:37:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F4678D0005; Tue, 28 Jul 2020 06:37:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E3958D0006; Tue, 28 Jul 2020 06:37:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id E8F978D0005 for ; Tue, 28 Jul 2020 06:37:42 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9A5D11EE6 for ; Tue, 28 Jul 2020 10:37:42 +0000 (UTC) X-FDA: 77087133564.11.cake52_27177a426f69 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 68D65180F8B82 for ; Tue, 28 Jul 2020 10:37:42 +0000 (UTC) X-HE-Tag: cake52_27177a426f69 X-Filterd-Recvd-Size: 4666 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jul 2020 10:37:41 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id t1so500395plq.0 for ; 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=uI+//3tN/ImGVW5ecgO4YBj55tDCC0T49l9v4KzWTa1XfniywvntmnXRW59GtalnJQ 6m0QvcMaIifpsI8bCBlTWEl+LiooME+g8eMulz+OI2gGKIdWyxEgqUG3THrWL+xKKv77 AGqylyy5ZfbSPsJV9DqoBSV/RyjoxzJsoX1oy/lbsiLu7fdhMTQo/Y3MJRm++KiG0yDc 7moGgY8zATVGhnbQPqIylQFQ8lvUFSehJsreSs+1lR2N7Q2hwsvd+u79e46pFh95hFG6 OgKDFRaj9uORzkA2knfxhhKrhDu/obp9U4guojko6cQdtxXX3sGex8z5YqWk2a5udh5d eVrQ== X-Gm-Message-State: AOAM533XJ2yMV93vJqVS1KYnZEjc1AZCM4k5UervKk36H9xE0sRqA5Lf zWbsWohXpGMo9J4TzeMJ2WY= X-Google-Smtp-Source: ABdhPJwVrLwph50FIXRt5B+ywFoKZvGGyXpS2YKkXOReJgJvV2vg6ygDdt0e1KPG7SDjhDzEBQVaAQ== 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 X-Rspamd-Queue-Id: 68D65180F8B82 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: 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