Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp1212461pjo; Wed, 8 Jan 2020 13:55:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzi/YEGQS69oQOMvREgm50vCThAO4KHfkjx+FkugJuxwWVX/cNHRc7LWkLhKQIxY4adTPaG X-Received: by 2002:a05:6830:2057:: with SMTP id f23mr6139681otp.110.1578520558279; Wed, 08 Jan 2020 13:55:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578520558; cv=none; d=google.com; s=arc-20160816; b=F+0lLNc+hk3GSyTzfsGplqE6KId9DhJIs0kzwi7hcggXMjgcBG6SWNPTQhL8A+IYj4 llBIilaDGbF0y9VYsnGy+0K2GrQEkeokDIaL+LK0jExDnFiz9fmeg8uXOG90uk3Q5uSU X1QLF5j0OQ60BZDjtmkcJ/ARZI9dyQlmnMTl0/gSvmRJB3oHdG42Bx+hex0R91I2B8aC y2tRu9BA3f9fkGJVUVBzBpcjtE4UDPapp0QP33262Dtipdx3R1MiAw+rXh18TSCiLlLq pPhgrOYnc5MSPBv9GFX+dO+Hth1Ws83PNdvPxDkAyGCKECMK0lHjV9THe7bi5Ctjil5h /Zdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PcO+MDLhWBt21xwDQCopIJyzwLlsTiv/SyUjv3ySIbU=; b=ATKzsZanZAhh18KFiusGOEm7qL/pfN/MM6eWY8xggV7IWY1s+orW3twFgGbuqGhcRW Orl6V3cAqUc70nq/wa3WHqfaOOKDMCN3yUfft+w4slbc3GqFUPtrvMttlou7G0jX2579 LDu05bB3vBv0AZa+m+HHeIX/sdmHS0icXBYb3BcKl5chPFbfcBj0vBcx9M/CoX9T7HtZ mnKErIW/jvRoraMl6fmTFOuNavCgdG83hz5s91uVpvSyIyn3+OAXYar09ME6GI7ofCQI ntdqdd5HfjmKU3CsUVhjW7i8m4jGzsxstgotMSMssp0Ko6AxJS88F7+boWW41AyMEtQX 1+kw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si2692935otv.149.2020.01.08.13.55.45; Wed, 08 Jan 2020 13:55:58 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbgAHVym (ORCPT + 99 others); Wed, 8 Jan 2020 16:54:42 -0500 Received: from mga09.intel.com ([134.134.136.24]:5184 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726390AbgAHVyl (ORCPT ); Wed, 8 Jan 2020 16:54:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 13:54:41 -0800 X-IronPort-AV: E=Sophos;i="5.69,411,1571727600"; d="scan'208";a="223053020" Received: from rchatre-mobl.amr.corp.intel.com (HELO [10.24.14.130]) ([10.24.14.130]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Jan 2020 13:54:41 -0800 Subject: Re: [bug report] resctrl high memory comsumption To: Fenghua Yu Cc: Shakeel Butt , Borislav Petkov , LKML , Thomas Gleixner , Ingo Molnar , x86@kernel.org References: <20200108202311.GA40461@romley-ivt3.sc.intel.com> <20200108214250.GB40461@romley-ivt3.sc.intel.com> From: Reinette Chatre Message-ID: Date: Wed, 8 Jan 2020 13:54:39 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20200108214250.GB40461@romley-ivt3.sc.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fenghua, On 1/8/2020 1:42 PM, Fenghua Yu wrote: > On Wed, Jan 08, 2020 at 12:42:17PM -0800, Reinette Chatre wrote: >> Hi Fenghua, >> On 1/8/2020 12:23 PM, Fenghua Yu wrote: >>> On Wed, Jan 08, 2020 at 09:07:41AM -0800, Shakeel Butt wrote: >>>> Recently we had a bug in the system software writing the same pids to >>>> the tasks file of resctrl group multiple times. The resctrl code >>> Subject: [RFC PATCH] x86/resctrl: Fix redundant task movements >> I think your fix would address this specific use case but a slightly >> different use case will still encounter the problem of high memory >> consumption. If for example, sleeping tasks are moved (many times) >> between resource or monitoring groups then their task_works queue would >> just keep growing. It seems that a call to task_work_cancel() before >> adding a new work item should address all these cases? > > The checking code in this patch is also helpful to avoid redundant > task move preparation (kzalloc(), task_work_add(), etc) in the same > rdtgroup. Indeed. > > How about adding both the checking code and task_work_cancel()? That does sound good to me. There is something in the current implementation that I would appreciate your feedback on: Currently the task's closid and rmid are initialized _after_ the call to task_work_add() succeeds. Should these not be initialized before the call to task_work_add()? Thank you Reinette