Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3733330ybi; Mon, 29 Jul 2019 11:37:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNixuYB0iWbGQUH60J7JdCcOw3oh5owXMadPYLnq2cPJjWb1/6I3PNeXDjZFY9nLFi45oE X-Received: by 2002:aa7:84d4:: with SMTP id x20mr37546296pfn.60.1564425421812; Mon, 29 Jul 2019 11:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564425421; cv=none; d=google.com; s=arc-20160816; b=uu24QfbqENm/1dKm4ZGe8kn6V24TW6/IqAgiEPoMUOtgxGa7qObTNnlTOzU7Q6WTWJ D3F1teodx39v6Wdc7mDeTWL4O/JHikmMoTeCGmEfiuY4D/n7ZSfC4eQDiozrcJKTYqQe 1bRYZGsvhWcn4ndPOlNbeaJ7ZuZKAFEh5ogZJBRft+60BGF4Lt50kbLIIyyHYy8JILMM LSK7stixB1otKa9mUMlu7aFo1GYSlwcxbh3HFWDfQ9G3Bgy/lFymCgycZwJunC78JkXy WIocqO9TdYAbJSHkoH8bTvn2gfwuVFYbzbdC1Ori5EYW9whcbbVWy+c4CJt7ikptVHle bkYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=gC8MExgYn0xfQlLGf7vnCj4KnLvnunZ3t62f8U+o32s=; b=V8QqIuYEObVCQ/SwB09UqOYbKUhQo5JHWBxJ8NZ/ltLbIr03VXDztV+EUfNxtRjaBa Co18s7nJvJ2QpbRvF50mTXfaArFK7Sm0jjhwbHI4hLnEs/C2eVZme9Ty75KC4v60i78t 1YU/h9tYKQb19Q5OxqBDavoCyUodU5YFJs+yJtCM+lr56WiAJA6b7cCJIKYxmaE3PvEG LJFkFcFgm3tcjMi478Z32RQS7MDHhTcK3pn2j79PKz6rMc/+sqW7C1l3k6I5wFLGP8Hl YywpDNLuMo1V6A+1l7m12MR5Sv0331FMbLjJUrZKDqpk8Vb44zgSmUgQjomD4xJs6jaF fGug== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si29912554pfd.259.2019.07.29.11.36.46; Mon, 29 Jul 2019 11:37:01 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728276AbfG2Pht (ORCPT + 99 others); Mon, 29 Jul 2019 11:37:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725209AbfG2Pht (ORCPT ); Mon, 29 Jul 2019 11:37:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE805300CA4D; Mon, 29 Jul 2019 15:37:48 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-160.bos.redhat.com [10.18.17.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11B105C1A1; Mon, 29 Jul 2019 15:37:47 +0000 (UTC) Subject: Re: [PATCH v2] sched/core: Don't use dying mm as active_mm of kthreads To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld , Rik van Riel , Andy Lutomirski 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> From: Waiman Long Organization: Red Hat Message-ID: Date: Mon, 29 Jul 2019 11:37:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190729150338.GF31398@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 29 Jul 2019 15:37:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/29/19 11:03 AM, Peter Zijlstra wrote: > 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? >> 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. > The 'sad' part is that x86 already switches to init_mm on idle and we > only keep the active_mm around for 'stupid'. > > Rik and Andy were working on getting that 'fixed' a while ago, not sure > where that went. Good, perhaps the right thing to do is for the idle->kernel case to keep init_mm as the active_mm instead of reuse whatever left behind the last time around. Cheers, Longman