Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3759955imu; Tue, 18 Dec 2018 03:49:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WAXYWC43lVRoqid23TvXr/wl5vbkKCrx/+yvJ2llJgBYRZsUQkIjxWoS+YvCJ1q/VJZRJD X-Received: by 2002:a62:4851:: with SMTP id v78mr16489624pfa.97.1545133769334; Tue, 18 Dec 2018 03:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545133769; cv=none; d=google.com; s=arc-20160816; b=T2AB0X65HelotL4pQzyuf6f8iSIaBj7XwWPd7SkhRK3XBpozE1q+3+mVHrr32vGzA2 5oWVw0Jd3m6yx3KeEkp9zxU1aHYZWkYO+sLJ2qBAp4/akySC/LjEoTtTte8/J9dlsaUW GQ0kzA4ZnPfMWDTxJvPQ11sDe53vwoW8LR1wsTbVbg5JSeQz9UqO2Py/TcD2/5KM/nxU vKNIBz9/1ldPKb/PFQ1sw3U6fRQUbJ9aLR7wSfg5Mfqc3XgiNyboRMLiGseEGyqjWyG+ Y7Y6jFRneOS8gI8WYwg5/fBv2lj2ysYIXdEYuwEjrS1Nj6w1ciOYFscOkSsST3uP2xC2 jRJw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=V7ytJxmEsvDt5YyXPbY21mnNAMkUX4RRWiYrWtiQNMc=; b=o4O3FwH0PmnUQTBn1jhCB7LFv2o2vksv0H0A+3DXp53b+inCLRhzuojYh0qWUJDYYT EuGT0MVGGu3OXPmkxO2iZVNFDup/eoy+JZrp1nGEEmUlnCT+CWJ4qJlwqItO8Wo/iGQd NLkX8aOQA7VcoEwCWTGMnOYIF75euj1kfWqyadUjCnvtPY4DRYHURZH3Dpwz9AvaTaj3 dqG7ZFmOoFS4AyypgPW9yNFlVihWKKU8T/8GzV0gX+UtBMQ7U2wjRIusNrWodEBQvySD DJ3KxDUMv+lxq+rbB/FkuvbznXVGoWA7cXhd5FBsowDASiP/XGxphBHZIuoV2ZpEP0XH MmcA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf17si13244550plb.52.2018.12.18.03.49.13; Tue, 18 Dec 2018 03:49:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbeLRLre convert rfc822-to-8bit (ORCPT + 99 others); Tue, 18 Dec 2018 06:47:34 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:55753 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbeLRLre (ORCPT ); Tue, 18 Dec 2018 06:47:34 -0500 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1gZDq8-0008Ci-RG; Tue, 18 Dec 2018 12:47:08 +0100 Date: Tue, 18 Dec 2018 12:47:08 +0100 From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: zhe.he@windriver.com, acme@kernel.org, ak@linux.intel.com, alexander.shishkin@linux.intel.com, bp@alien8.de, hpa@zytor.com, jolsa@kernel.org, jolsa@redhat.com, kan.liang@linux.intel.com, mingo@redhat.com, namhyung@kernel.org, tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Subject: Re: [PATCH] perf/x86/intel: Avoid unnecessary reallocations of memory allocated in cpu hotplug prepare state Message-ID: <20181218114708.p6fpz447brob4kzz@linutronix.de> References: <1545129033-21757-1-git-send-email-zhe.he@windriver.com> <20181218110209.GD15430@hirez.programming.kicks-ass.net> <20181218111637.b53u5pi3nxnyldaq@linutronix.de> <20181218113119.GG15430@hirez.programming.kicks-ass.net> <20181218113700.GC16284@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20181218113700.GC16284@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-12-18 12:37:00 [+0100], Peter Zijlstra wrote: > On Tue, Dec 18, 2018 at 12:31:19PM +0100, Peter Zijlstra wrote: > > On Tue, Dec 18, 2018 at 12:16:37PM +0100, Sebastian Andrzej Siewior wrote: > > > On 2018-12-18 12:02:09 [+0100], Peter Zijlstra wrote: > > > > On Tue, Dec 18, 2018 at 06:30:33PM +0800, zhe.he@windriver.com wrote: > > > > > Besides, in preempt-rt full mode, the freeing can happen in atomic context and > > > > > thus cause the following BUG. > > > > > > > > Hurm, I though we fixed all those long ago.. > > > > > > > > And no, the patch is horrible; that's what we have things like > > > > x86_pmu::cpu_dead() for. > > > > > > ehm, you say we keep memory allocation +free on CPU up/down? > > > > Sure, why not? It does not seem to be useful to allocate & free memory which you need anyway. So you could avoid the refcnt for instance. Also I doubt the memory will remain unallocated for a longer period of time (like you would remove the CPU for good and not boot it again a minute later). *Maybe* it is different in cloud environment where you attach vcpus depending on guest load at runtime but still… > I suspect the below is all we really need. Zhe, could you please have a look? Sebastian