Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4533062ybi; Tue, 30 Jul 2019 03:45:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzev5VYK3M8bBxaw5mlIlZv1FZpwCikr+81eojk2nKR1hzj6E7q2jat9hmLZWAMcQs/OINR X-Received: by 2002:a63:9245:: with SMTP id s5mr110435224pgn.123.1564483553418; Tue, 30 Jul 2019 03:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564483553; cv=none; d=google.com; s=arc-20160816; b=Yw865F+bRf5XxTDEI+ha/GdmAH4UH6xL/Wz/Yv/JayIenE/mG5NDztLEgrln/Vwk0/ 6diWq/8GEtJyQq1HmbdN6PKpmww7u3BQW7mFRLslt+3igRWOQv0GSCwYc/kmwu8YPZUa AT84B7U7A9wKqUf4VrSFGYhjyidkLkIOA8oFmACjUcnogzFEIacXsTb1KdzSwDkJn8mJ 06agCYaDrRsK218QBM5Jw/8tyb6U17JI8lhGAsL/nUNfZd5q9zLxbYJOkh3X/35Q7YHg 07VRxPyqlyog4pWTUs71MZ/9Hw67YkuDdN2in0rjMMgEFfERF70qFOaJxANDPHi2yMUT Wp2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jhRzIYYEmuVUOTGwaq+DyR74kZDRRNMzR/NeqxkZ39w=; b=znOqLeinpJBufvJzZ0w7DoZeyh79dKOE8WfmUF1cK9EV9X1Bq0XIN82B1VsPtN4GBl FOYweoNePsnMMpQUmnDwugQQP1QmtHZCR3FRtK0uE0cJacI84LBx6B5tNSwrOzUKTjAv jVUWcuG1D52zx3LEfy6meehw2DiWY9LOwDea/zVJ/WhFrgdUHBFhQ/v+B2kKiD/nslQs sNQSNC3zjGPuDTZKzxm2IFiXqH/mtXT7Hnnd1GggtPlMFiZ9XpYQUhsvoeAphJZ4q6Uy KrX60OoUWkXExM+v+lebhUYE7F9PG+fPgloBNju1QAzcZwkppl4Mf3eHB6A5m4rMQKHb 281g== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si27451128pju.77.2019.07.30.03.45.38; Tue, 30 Jul 2019 03:45:53 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729182AbfG3HYl (ORCPT + 99 others); Tue, 30 Jul 2019 03:24:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:52754 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727527AbfG3HYl (ORCPT ); Tue, 30 Jul 2019 03:24:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1B770AE5C; Tue, 30 Jul 2019 07:24:40 +0000 (UTC) Date: Tue, 30 Jul 2019 09:24:39 +0200 From: Michal Hocko To: Waiman Long Cc: Rik van Riel , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld Subject: Re: [PATCH v3] sched/core: Don't use dying mm as active_mm of kthreads Message-ID: <20190730072439.GL9330@dhcp22.suse.cz> References: <20190729210728.21634-1-longman@redhat.com> <3e2ff4c9-c51f-8512-5051-5841131f4acb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e2ff4c9-c51f-8512-5051-5841131f4acb@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Michal Hocko SUSE Labs