Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3728970ybi; Mon, 29 Jul 2019 11:32:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyF3zYtpNz9H6PnKqqktZaFkL0uujM24xvgfKvKVhCNeInLjwQzL7f+UtisK3B7B+N+o68O X-Received: by 2002:a63:f807:: with SMTP id n7mr108863611pgh.119.1564425153699; Mon, 29 Jul 2019 11:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564425153; cv=none; d=google.com; s=arc-20160816; b=PpRqvX2WKT5uQKg6ehJPeviIAglF1IweZVK14SW7oIgha4TMeev9VeETahLWrSZcfG g/t4MH1ufrDtSIxuKKS9hat+dFUZRWTgaHzHg8saN5tfaZpjI774EdQvYLC8yd7wYZc9 s1SLQ+Ib3lagN7wFUNy73/K+PI6UxxIgF3YnpLgAV3yoRLQYgIVC5IH+qTMBoudn9W9g P86FQM0OfgAxYSkt0SdcS+U/jEZSb5F1a+RaRRfmao++1KUj51xf6k65FQdvQNfLrB3H BRY8bDYL6opWj5DaMhUOvTOT0otKUptg+ZG+SN7dsLAOd2nwBw0wMzhSsAxL1bQzIHW1 ai+w== 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=8xbb/FjrwKKI0IQkehdSVj7NRbt4D1OnqJy1F4uBWaU=; b=gTNx1yPr7APvGbFJAbNtd3+Xu4qTEiybZviubOnqmAaf8bjuACxTUhBchkjfgovOWD JnIrcLSEa6jUmd2HOwXQabYFjqzXFZnZDqhF+PTRsMR8x1av2MF82aervdmBFuHyz+44 XStRBHNeGX0qlFg9gBPlfwc6xvVgdWqKrgwdf4/04mgDriyifEBpqJD3QiKkL7kqOSBM EZ8CX6HjCxtf6plVRGxBqj6h9iyKEwEuREg2uTGp/+N5YHn6DMb5aWisL7rtMB5e4xcS 6MVbgddCfzRn+LvEQiHJ5xH5rmdy4ljwCpSNh3OLve7YKe2zUeWKSv3lXXrMYFZ1eMWK sucA== 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 e16si27429874pgt.2.2019.07.29.11.32.13; Mon, 29 Jul 2019 11:32:33 -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 S2388025AbfG2P1h (ORCPT + 99 others); Mon, 29 Jul 2019 11:27:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38408 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387854AbfG2P1g (ORCPT ); Mon, 29 Jul 2019 11:27:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A19BE8E22B; Mon, 29 Jul 2019 15:27:36 +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 DF0C510016E9; Mon, 29 Jul 2019 15:27:35 +0000 (UTC) Subject: Re: [PATCH v2] sched/core: Don't use dying mm as active_mm of kthreads To: Michal Hocko Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Phil Auld References: <20190727171047.31610-1-longman@redhat.com> <20190729091249.GE9330@dhcp22.suse.cz> From: Waiman Long Organization: Red Hat Message-ID: <556445a2-8912-c017-413c-7a4f36c4b89e@redhat.com> Date: Mon, 29 Jul 2019 11:27:35 -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: <20190729091249.GE9330@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 29 Jul 2019 15:27:36 +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 5:12 AM, Michal Hocko wrote: > On Sat 27-07-19 13:10:47, 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. > IIRC use_mm doesn't pin the address space. It only pins the mm_struct > itself. So what exactly is the problem here? As explained in my response to Peter, I found that resource like swap space were depleted even after the exit of the offending program in a mostly idle system. This patch is to make sure that those resources get freed after program exit ASAP. >> Fix that by forcing the kernel threads to use init_mm as the active_mm >> if the previous active_mm is dying. >> >> The determination of a dying mm is based on the absence of an owning >> task. The selection of the owning task only happens with the CONFIG_MEMCG >> option. Without that, there is no simple way to determine the life span >> of a given mm. So it falls back to the old behavior. > Please don't. We really wont to remove mm->owner long term. OK, if that is the case, I will need to find an alternative way to determine if an mm is to be freed soon and perhaps set a flag to indicate that. Thanks, Longman