Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4170242ybi; Mon, 29 Jul 2019 20:48:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5dyXY9SJ7iVsta18pjLJHCIOSQbx2QXNVaaopSJSVfPnvIyT2ALzu92FCrYEN2xXEJ3qR X-Received: by 2002:a62:b515:: with SMTP id y21mr40594218pfe.213.1564458491742; Mon, 29 Jul 2019 20:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564458491; cv=none; d=google.com; s=arc-20160816; b=r+vGb+UVgkGXUfJkzjOSerBdtr6Mb0js90mXHQ2S2b4pmJqM4kaxbWCSbPm0t59ABE r6LM5QIAYQ1sZb8dYuwAnPJBXjx8cill9iN9MwbYPizyiWp5srR4TaF8uSTuLBRPy4/Z YUgbYTLU/zaOm1PhgnjUT1O6xdC/homxDwP1eGEpYf6ezURVtqAYbUeF19doiprMx8Rx socWImrIoctvQozbxdnpWa9nP5l9YRE3aD8BRmO4DeJpO5xd60nmTkoi7ShXpWiClZaF oEQvYSea5SbDUPs1SBeajigmoRU0coAr2+fya9iJYW8jOOf/oMIVGC5Z2hrcsz3nnAos 13mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=OG43dKE5EHdLsloVp5kr47KFclKp0v6i6aNn4A4Rt1Y=; b=wkhRS/nCFT0SbEDKaWBNqCZ/KewFo2L3HLFeg2j4dcFMUBqhWK0PQ3Zt6b6J8CdC0E 2+1CjgXoNqTyXZI92rOktO7/3aJabpwZFGApyLjcUMiloOS7/3YWKFMKHq466F/RRjJ7 KM9FiWfUxJ7+6n+R2LEkLAqYmPwcHtQD4lRcUGuLpDrlue2lmqDLWmzdY6lNMshJHCjt 76YaxWPAN81TNeFLwWjJRtWLdTKNy+6WVXl6CR79qVuxBvGymPru6bLJow7giZbrRD5N l+Y4WQqTLbvu/69bVZn9WcsgInTu6+1v1Lotiuze2x8gv7NY0Wwq+YIpM1K90vA7wXHL 2HNw== 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 x13si33217755pgf.275.2019.07.29.20.47.56; Mon, 29 Jul 2019 20:48:11 -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 S1730072AbfG3A0s (ORCPT + 99 others); Mon, 29 Jul 2019 20:26:48 -0400 Received: from shelob.surriel.com ([96.67.55.147]:49322 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730023AbfG3A0r (ORCPT ); Mon, 29 Jul 2019 20:26:47 -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.92) (envelope-from ) id 1hsFyU-0000oP-0f; Mon, 29 Jul 2019 20:26:42 -0400 Message-ID: <8021be4426fdafdce83517194112f43009fb9f6d.camel@surriel.com> Subject: Re: [PATCH v3] sched/core: Don't use dying mm as active_mm of kthreads From: Rik van Riel To: Waiman Long , Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld , Michal Hocko Date: Mon, 29 Jul 2019 20:26:41 -0400 In-Reply-To: <3e2ff4c9-c51f-8512-5051-5841131f4acb@redhat.com> References: <20190729210728.21634-1-longman@redhat.com> <3e2ff4c9-c51f-8512-5051-5841131f4acb@redhat.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-lY3NRPxUErEaURZG51iL" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-lY3NRPxUErEaURZG51iL Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-07-29 at 17:42 -0400, Waiman Long wrote: > What I have found is that a long running process on a mostly idle > system > with many CPUs is likely to cycle through a lot of the CPUs during > its > lifetime and leave behind its mm in the active_mm of those CPUs. My > 2-socket test system have 96 logical CPUs. After running the test > program for a minute or so, it leaves behind its mm in about half of > the > CPUs with a mm_count of 45 after exit. So the dying mm will stay > until > all those 45 CPUs get new user tasks to run. OK. On what kernel are you seeing this? On current upstream, the code in native_flush_tlb_others() will send a TLB flush to every CPU in mm_cpumask() if page table pages have been freed. That should cause the lazy TLB CPUs to switch to init_mm when the exit->zap_page_range path gets to the point where it frees page tables. > > If it is only on the CPU where the task is exiting, > > would the TASK_DEAD handling in finish_task_switch() > > be a better place to handle this? >=20 > I need to switch the mm off the dying one. mm switching is only done > in > context_switch(). I don't think finish_task_switch() is the right > place. mm switching is also done in flush_tlb_func_common, if the CPU received a TLB shootdown IPI while in lazy TLB mode. --=20 All Rights Reversed. --=-lY3NRPxUErEaURZG51iL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl0/jsEACgkQznnekoTE 3oOE1ggAg1gUM2xB6saQQir2gSvZrUyxU6Zo52SS5CmO3mkJP2423lRU37awDIez nM76nLTpWiME/vXpMA3lzHxnCcQ0uQuXOt9JvXUn3Cn1C+fd6sAC7NjD/aCMEnam AHSk0qRNcoiwN56n3r5bVlkBi7UymKO+NLXA2hlMLNl9vNKRGYshbo8b44h2Cv6M Mbbe2ap47z5siyZUphm6/lbK1hZlNLXuf79CCYJDEKzuqXac4ij0RUieOkWpgJxw 4SH8meLRYykoIj2PPFCELl/urg/sIaDQlVqLd5G5ejMMrBQDKdfb4/coCdnhqL1l 0jCbfSYDSxlucg4rvV5J1zmjT9pTEA== =dova -----END PGP SIGNATURE----- --=-lY3NRPxUErEaURZG51iL--