Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5229911ybi; Tue, 30 Jul 2019 16:38:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGRx0vFHcl43K2KWOFfHVtkO1viKp0p14woQN09+1DeaXiqNIlHQc7+cmvEqz4amY/Iucy X-Received: by 2002:a17:902:7887:: with SMTP id q7mr119397714pll.129.1564529902236; Tue, 30 Jul 2019 16:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564529902; cv=none; d=google.com; s=arc-20160816; b=VkbqO0hNSS4ix2FRRNdK6AfJarygySHhbD7vFfR/7naPZpI1oY5QVx0/hFNT4LdFuw UHX2wRYl1DvdABvNlLN3I4b7HCSFhd461aBOIvXicNhH0MT8652EW7gOwQ77Wh9l4FHc oIhRuAmTm2bvFhbNPXdSMI9WkgITQBVsZd2vUGj9qxwjOCHP6ueZnYWuaSvttwq/C4Se 0Hh5OyEYZVx/mv0WE0JM7jLG+uHXLtXfJJmTJ1D7qv+ni3qPq3BqeJOpq/FmPdC1phXP dn3tmClWTTDrJPXUjEhCBRqLdCuxPFZwIiRgCW8N3ono7OzK6hlJM4cPFcO0sp1e0LH7 Q+3Q== 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=8OVdJtKbIuHNeaAmHrYp4QUgLmn/UwVV+QQLtxKMZh4=; b=z2O7cx9AfvBccgiHtwZZeEt1/JO6ePUvXPYEiqfHbR6oh6F2YJpuAnbyS07aFOxTbu woNdRh8NaD+jpJVftsqdww67COdkYJvEbC6GWCmPWrqyX40WHJ4P7ihinggj5Ooe/06g 89jjjFd/KKu+4/sttnO+k6QTtG5MGDd+6e0lQksem7h08BPsz9uynnw4PIxHwEc9dw+D g+Qh48FVGvGJMNbwo4kEJiGKJ0fxrfBOHItjDhn+Hg3dQ2Iel+lw6cdqQ4K2NQbsSKy1 Bm4t1XJAezXFHBViceF+3iEFhXTR50uW25q+EwaVfTzmghALktkLvMpT53hcXW/Nl7jP UBxQ== 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 m3si16853384pld.385.2019.07.30.16.38.07; Tue, 30 Jul 2019 16:38:22 -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 S2387538AbfG3VFv (ORCPT + 99 others); Tue, 30 Jul 2019 17:05:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42060 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387515AbfG3VFv (ORCPT ); Tue, 30 Jul 2019 17:05:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E9BF308AA11; Tue, 30 Jul 2019 21:05:51 +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 7AA7E60BEC; Tue, 30 Jul 2019 21:05:49 +0000 (UTC) Subject: Re: [PATCH v3] sched/core: Don't use dying mm as active_mm of kthreads To: Michal Hocko Cc: Rik van Riel , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld References: <20190729210728.21634-1-longman@redhat.com> <3e2ff4c9-c51f-8512-5051-5841131f4acb@redhat.com> <20190730072439.GL9330@dhcp22.suse.cz> From: Waiman Long Organization: Red Hat Message-ID: <31cea85f-8d8e-a701-db75-fe1ec67d6c29@redhat.com> Date: Tue, 30 Jul 2019 17:05:48 -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: <20190730072439.GL9330@dhcp22.suse.cz> 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 30 Jul 2019 21:05:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/19 3:24 AM, Michal Hocko wrote: > On Mon 29-07-19 17:42:20, Waiman Long wrote: >> On 7/29/19 5:21 PM, Rik van Riel wrote: >>> On Mon, 2019-07-29 at 17:07 -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 some resources that cannot be freed >>>> on a mostly idle system. >>> On what kernels does this happen? >>> >>> Don't we explicitly flush all lazy TLB CPUs at exit >>> time, when we are about to free page tables? >> There are still a couple of calls that will be done until mm_count >> reaches 0: >> >> - mm_free_pgd(mm); >> - destroy_context(mm); >> - mmu_notifier_mm_destroy(mm); >> - check_mm(mm); >> - put_user_ns(mm->user_ns); >> >> These are not big items, but holding it off for a long time is still not >> a good thing. > It would be helpful to give a ball park estimation of how much that > actually is. If we are talking about few pages worth of pages per idle > cpu in the worst case then I am not sure we want to find an elaborate > way around that. We are quite likely having more in per-cpu caches in > different subsystems already. It is also quite likely that large > machines with many CPUs will have a lot of memory as well. I think they are relatively small. So I am not going to pursue it further at this point. Cheers, Longman