Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3776776ybi; Mon, 29 Jul 2019 12:25:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpei7QXroozhkBhHeykVz/0FLZO58u5bmLwKGRSNbWfgAVMZei1icywIkvBQ+RN8hwiDZZ X-Received: by 2002:a63:3046:: with SMTP id w67mr68421394pgw.37.1564428321050; Mon, 29 Jul 2019 12:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428321; cv=none; d=google.com; s=arc-20160816; b=cnVygJmVZnRoi0HFCWWnIhHoSESmIFzI8aCF0u889PzEAUToPXfrS0bYal/gykvjFq 8xqbF8s2xjpnRvb9qO3l//lmWRoLeiv1ymIb6lD7Mxs9XmssL+Y1dbKDrVA/SQYuJqrO tJ6NF2qPEh3i4JvrPUdoXHthN0xY4hsPUUYjVZFGIv4bLEKEksUhg4S6tm59W3FM42C/ 7UEP8mI5c7j33P6pzk2jsZMcc/3igiO1iKr3LZGq/VNXKYvecbmyPdyRXi+uMaVXBNhM 20MfQ8n1nUqR8UzwZWrdG+UAExf4f1i/N+F+8uAfGlZLNVcJHDCOewvTlScRmASBLm9T Uedg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=TGe/geZ87qC/Bj1IMgqU+ytXYrP/0N7tQMUhQt/p3/s=; b=xECcIvwH17YFKIfyQDLhZCJdOjePtmq4peZPggkCVmqgeeL2RdJcj/nMYD7SMGAzJx SsP20Rirz5PZBpVYBSw566RXhwewit/yLc5edUHguHhDckH093J1JKiXxTT+n56lVd15 dl9T0dulGP+SlGzQyR/5vozm0TSzawZsDOqxVEiMGmQJyXFAcQkXSp+bVmV6ZIAkjqPO VfgG94ZyNeUGlEtx9029QTRaNjSIyvVXUcgdSjZLcjw8jgvjqD97+MEVsvJyG7Yw+fm5 LmSeMfJzg4tXTtdwFs23DZ9TpI4J+ooge9Ltz2XxT8ZyJJOjxpYISUdm5T7ptQhyhxbp JSsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="d5BbKW8/"; 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 59si26026717plc.425.2019.07.29.12.25.06; Mon, 29 Jul 2019 12:25:21 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="d5BbKW8/"; 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 S1728690AbfG2QXA (ORCPT + 99 others); Mon, 29 Jul 2019 12:23:00 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42136 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbfG2QW7 (ORCPT ); Mon, 29 Jul 2019 12:22:59 -0400 Received: by mail-pg1-f193.google.com with SMTP id t132so28501981pgb.9 for ; Mon, 29 Jul 2019 09:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TGe/geZ87qC/Bj1IMgqU+ytXYrP/0N7tQMUhQt/p3/s=; b=d5BbKW8/plsBM1AKOfuFUhf26MKZlqMYSKZDr8YVVWH1IQPUij8aMiPu4C+K9FSEMO r4nAW5vgRlXPfAiJoR2Mo/SVuNnvyA+9FpLZefF+PeC8iy3gma6OYYB3emW4chRNY+Oi Up2xrTvtE4xPfvotTloTBiJcshYpwNAdYxWuzPcg8qsDe+cMHsRul3r18mDjwMymD2pr EllcF47OUaf0ugNxSYdeljZCTi/tC4FKHS14+RTLb+YtgIJuVTtnlLNx3WIh2aZHvOB5 xWHx/cfPosBIEtg1/8Sq9RROEL8NTq3owgj/7WE/vEEf0dPBKloa07fUa0FPY98fAIeU SgCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TGe/geZ87qC/Bj1IMgqU+ytXYrP/0N7tQMUhQt/p3/s=; b=E1J0nE7d/7y5+pZBAZeB8Q2mCiHL5rQTZ5PMdIUhLxutuvIV/iHqwlOXe6XP5TKtgy HBcCevtb96GJWcQ8e65Rpcs4GevP6e/xtx0RYAEZT6XZ03veZXZUJ2bW38oumE+TKlzx JsjOFXMxbjOHxah0AUYCZVGhpPqHEXP/i2ymsRrNDxqMHF3iI4/jgz1EFzgmC3hR3BvC 1xLdTKF1fkq96HYiXedw0r/+Gw2yuRsJirqtozxj+WFHnxYplDQAkA0yAkpaB+5dSE7b XWasmyY6MfPPRohNEbMHHa70+2ssxz2TKIWCY8U/udsLtRN80XCxAeJZQCgzwIm9oZAh 1tZg== X-Gm-Message-State: APjAAAXMazfyu1oRGQ3US9R4NyfVPo9AJiXAUy0hd5OdqNpFzfkwc81h vxczrgaumD3wCHao4aMKAruo+mnHo8g= X-Received: by 2002:a65:6256:: with SMTP id q22mr104646436pgv.408.1564417379277; Mon, 29 Jul 2019 09:22:59 -0700 (PDT) Received: from ?IPv6:2600:1010:b041:eebe:98d2:d02:46c3:a133? ([2600:1010:b041:eebe:98d2:d02:46c3:a133]) by smtp.gmail.com with ESMTPSA id f27sm45266394pgm.60.2019.07.29.09.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jul 2019 09:22:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2] sched/core: Don't use dying mm as active_mm of kthreads From: Andy Lutomirski X-Mailer: iPhone Mail (16F203) In-Reply-To: <20190729150338.GF31398@hirez.programming.kicks-ass.net> Date: Mon, 29 Jul 2019 09:22:56 -0700 Cc: Waiman Long , Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld , Rik van Riel , Andy Lutomirski Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190727171047.31610-1-longman@redhat.com> <20190729085235.GT31381@hirez.programming.kicks-ass.net> <4cd17c3a-428c-37a0-b3a2-04e6195a61d5@redhat.com> <20190729150338.GF31398@hirez.programming.kicks-ass.net> To: Peter Zijlstra Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 29, 2019, at 8:03 AM, Peter Zijlstra wrote: >=20 >> On Mon, Jul 29, 2019 at 10:51:51AM -0400, Waiman Long wrote: >>> On 7/29/19 4:52 AM, Peter Zijlstra wrote: >>>> On Sat, Jul 27, 2019 at 01:10:47PM -0400, Waiman Long wrote: >>>> It was found that a dying mm_struct where the owning task has exited >>>> can stay on as active_mm of kernel threads as long as no other user >>>> tasks run on those CPUs that use it as active_mm. This prolongs the >>>> life time of dying mm holding up memory and other resources like swap >>>> space that cannot be freed. >>> Sure, but this has been so 'forever', why is it a problem now? >>=20 >> I ran into this probem when running a test program that keeps on >> allocating and touch memory and it eventually fails as the swap space is >> full. After the failure, I could not rerun the test program again >> because the swap space remained full. I finally track it down to the >> fact that the mm stayed on as active_mm of kernel threads. I have to >> make sure that all the idle cpus get a user task to run to bump the >> dying mm off the active_mm of those cpus, but this is just a workaround, >> not a solution to this problem. >=20 > The 'sad' part is that x86 already switches to init_mm on idle and we > only keep the active_mm around for 'stupid'. >=20 > Rik and Andy were working on getting that 'fixed' a while ago, not sure > where that went. I thought the current status was that we don=E2=80=99t always switch to init= _mm on idle and instead we use a fancier and actually correct flushing routi= ne that only flushed idle CPUs when pagetables are freed. I still think we s= hould be able to kill active_mm in favor of explicit refcounting in the arch= code.=