Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4315266imm; Mon, 30 Jul 2018 12:17:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfExjS+G1t0z8WqtmLoq3pq8Ya3eLfEdNyRQSKAPd1sqigKtw6MINQo0Edi+trkWx4l1hKw X-Received: by 2002:a63:b40e:: with SMTP id s14-v6mr17793199pgf.9.1532978270942; Mon, 30 Jul 2018 12:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532978270; cv=none; d=google.com; s=arc-20160816; b=G1XgODBtOMyfOxdhYhGDkvQ6RQGJwMmRMzElnJUZGAItUKkA6iD71upwwd3j12c574 Sa15My6dCyerTymHW8lNO6bw5L4/WU0OgaieAuCAG8fghHQ70rhhCkzcqDSxhBsxqL0f Yx3UTgpox3xJVp18ypZ29MjUg73XJEpwCnDbZS4q2VXv3myhd/Slc1iTzZK9UwBixGqJ edurkrWVclT7oO41djydnbZgsMIJ6ava53NhHBQgYHilonDf41MqX1UIbIy+7Ddpu0kb z6LPzak/FRj1O2a/hOHtslThFuanYL08IUDvowyWjNQyx64hev2opK21+Cem2E4VDO3s FKug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to:date :cc:to:from:subject:message-id:arc-authentication-results; bh=AkMe2Ez99UdxCGRBw5RTHDbHsJ8UlLmoiswKBEbavus=; b=EcU4qzFG3wgntFuet31XH2u6YE2cBTlHpBtMqNXvVXblZv6cppoOTwM+XVY4Oc/Jqq Ril7p4E0E7LS5BVTAEUH2U5CLgzdTG3IzHhErmZPrnwua5FVwlR7SV8DEkTnhl+Mo1RB Jk6U/fLkYf0lysrU60YRUU80A65abldaygQ0Wz+9Asw+4444/TkrbieZ9ic7rj8UUi0A /+MbSF77Lk0ZI1w3GMfl7Zo+fWft+QBF8vh2F3+sMjx7ym5BFcvGps+vQep5RoMmap7P nbzhVE61rTNM8T7wZf8FdL9u+aE4CK8fB7oLKVwez49GjueC6k68iUTonUYTjm1kSXBe PTew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g85-v6si13451286pfa.271.2018.07.30.12.17.35; Mon, 30 Jul 2018 12:17:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731934AbeG3Uw1 (ORCPT + 99 others); Mon, 30 Jul 2018 16:52:27 -0400 Received: from shelob.surriel.com ([96.67.55.147]:50284 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731047AbeG3Uw1 (ORCPT ); Mon, 30 Jul 2018 16:52:27 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fkDdy-0004vM-VF; Mon, 30 Jul 2018 15:15:46 -0400 Message-ID: <1532978146.28585.32.camel@surriel.com> Subject: Re: [PATCH v2 11/11] mm,sched: conditionally skip lazy TLB mm refcounting From: Rik van Riel To: Peter Zijlstra Cc: Andy Lutomirski , LKML , kernel-team , X86 ML , Vitaly Kuznetsov , Ingo Molnar , Mike Galbraith , Dave Hansen , Catalin Marinas , Benjamin Herrenschmidt Date: Mon, 30 Jul 2018 15:15:46 -0400 In-Reply-To: <20180730162653.GM2494@hirez.programming.kicks-ass.net> References: <20180728215357.3249-1-riel@surriel.com> <20180728215357.3249-11-riel@surriel.com> <20180729155452.37eddc11@imladris.surriel.com> <20180730095502.GG2494@hirez.programming.kicks-ass.net> <1532961011.28585.30.camel@surriel.com> <20180730162653.GM2494@hirez.programming.kicks-ass.net> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Q9QzGdlzwArfc2oCj/lV" X-Mailer: Evolution 3.26.6 (3.26.6-1.fc27) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-Q9QzGdlzwArfc2oCj/lV Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2018-07-30 at 18:26 +0200, Peter Zijlstra wrote: > On Mon, Jul 30, 2018 at 10:30:11AM -0400, Rik van Riel wrote: >=20 > > > What happened to the rework I did there? That not only avoided > > > fiddling > > > with active_mm, but also avoids grab/drop cycles for the other > > > architectures when doing task->kthread->kthread->task things. > >=20 > > I don't think I saw that. I only saw your email from > > July 20th with this fragment of code, which does not > > appear to avoid the grab/drop cycles, and still fiddles > > with active_mm: >=20 > Yeah, that's it. Note how it doesn't do a grab+drop for kernel- > >kernel, > where the current could would have. >=20 > And also note that it only fiddles with active_mm if it does the > grab+drop thing (the below should have s/ifdef/ifndef/ to make more > sense maybe). I'll kick off a test with your variant. I don't think we will see any performance difference on x86 (due to not using a refcount at all any more), but unless Ingo is in a hurry I guess there's no issue rewriting this part of the patch series :) Do the other patches look ok to you and Andy? > So for ARCH_NO_ACTIVE_MM we never touch ->active_mm and therefore > ->active_mm =3D=3D ->mm. >=20 > > + /* > > + * kernel -> kernel lazy + transfer active > > + * user -> kernel lazy + mmgrab() active > > + * > > + * kernel -> user switch + mmdrop() active > > + * user -> user switch > > + */ > > + if (!next->mm) { // to > > kernel > > + enter_lazy_tlb(prev->active_mm, next); > > + >=20 > #ifndef ARCH_NO_ACTIVE_MM > > + next->active_mm =3D prev->active_mm; > > + if (prev->mm) // from > > user > > + mmgrab(prev->active_mm); >=20 > else > prev->active_mm =3D NULL; > > +#endif > > + } else { // to user > > + switch_mm_irqs_off(prev->active_mm, next->mm, > > next); > > + >=20 > #ifndef ARCH_NO_ACTIVE_MM > > + if (!prev->mm) { // from > > kernel > > + /* will mmdrop() in finish_task_switch(). > > */ > > + rq->prev_mm =3D prev->active_mm; > > + prev->active_mm =3D NULL; > > + } > > +#endif >=20 >=20 >=20 --=20 All Rights Reversed. --=-Q9QzGdlzwArfc2oCj/lV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAltfY+IACgkQznnekoTE 3oMxoAf/f1g7N26Q4tMIw7hZs6yS/IE+ej9dk+Vox0xagDTfGpAPmoTgckFU7jse JFG/wXhmgrKTZUqaBxHf0kxcc7m/6iu/VbNrhO5TTkcj66iSMDDaep6qsfF4D0Bb fSU57V7zNltmUl+RQwQ8mHa2xBC66sa2pl5wKwDhuoO/+LnOi6rFkHpy7lssl4pV AhcHEQnwwxBvF3ZiqJ7fzl/Ukxw28zG+r+lBrc/JIR2SerhQJzbvkDXYg0hhSk91 UmARz0qLdvPE0W9bRFpQWhVjAiqfAp01pnWmCG05BvOI1o4m079livJ0kzrFDarG OIpb33DiYVfALYqRbGj9Vt5yYYtPmw== =WntR -----END PGP SIGNATURE----- --=-Q9QzGdlzwArfc2oCj/lV--