Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp753718pxf; Wed, 24 Mar 2021 15:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKwe/2yVv7qPIRYu8SKqqmrw0k8f5a1scn9pzZQzGedQt6NzZAbTfmp53ygxCoBY19RQKP X-Received: by 2002:a17:906:fcb2:: with SMTP id qw18mr5838465ejb.434.1616624492206; Wed, 24 Mar 2021 15:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616624492; cv=none; d=google.com; s=arc-20160816; b=cC1uEUvaao9+xQl94RyTQLQ3bYdKKePlcEMcfnpl5lcQGUPveLWTrJ569ADYlfiARm UOx4/HGBNckDEClvHtpbzotwr9tghd/HBkP2BK+dWh5grBcjm4LlnQY67Sa2TpbC4ybB f5Pp6AAKAHOS+sTi9DGvxxNImWyY+GZs3JYYNuBhDBFiWKQ6otzipNHeGAdj0icVXVNS r5L6jTRx2XIgbh+GCK8/L3dbya7H66+M3x1cML2IDJOeQgmLNGzskwCwOSs0sSGdtp3O /mrTt161YXPFttrEkWtSoT4WCzkuuerVGmkZqTMNehEJ8BFBiFt5tD7oWLJM8aLflElt j2eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=93sIPMiZo7YVpZ61t30+WQ7HYH7pXTkxprPmmpwHuig=; b=AmSoCkX8yEocpbZ7Zw0pq5TdF6rN+04SuSypXWnEGPZjQqN9fLBPP9Wm8g2m/c4NOZ Zw3XHjyxC+/T3suxr1WtwMWC2lwgUEkrOxUea+0qVwyGtXc7aROk/FoOidfEIGTymXom BhzI9r0rr7PIdBwLKZUQoOgp/fi2hKxd97yXgLf5SfNdajhNSjzmFfIEdhhPBy1emuBV seyCFvsw2xSUuPOVyDyQFlInjnSIXShlvGnjw4dDsVphlBN8emp5nvbZrUP+umofNnva N/A0DZOL+Jb0Fi4LJvOYyOxB9eda/lCzSgcZdIloYLAvoBjCOOLjZd35yRiHwArbzuri dH+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k2si2828493ejv.112.2021.03.24.15.21.08; Wed, 24 Mar 2021 15:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232334AbhCXDrA (ORCPT + 99 others); Tue, 23 Mar 2021 23:47:00 -0400 Received: from mga11.intel.com ([192.55.52.93]:64879 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232037AbhCXDq7 (ORCPT ); Tue, 23 Mar 2021 23:46:59 -0400 IronPort-SDR: sw5vsIl0SR7dcwEHaVguD+YFn+IZNEPrZc7bMRpPgdq3JqNNszXpGCXiQ9vuDyj0zzwajkydJm btEI070tQWGw== X-IronPort-AV: E=McAfee;i="6000,8403,9932"; a="187306899" X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="187306899" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 20:46:59 -0700 IronPort-SDR: LR427PnCI1tTW84ijuYJ1LfZxN+jp8JYaGJpV1UQPcTzoUOBrFL6WYhKU5FEtqEzkyGoyl1BXi vOFLQfb0N4sQ== X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="514027862" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.93]) ([10.238.4.93]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 20:46:55 -0700 Subject: Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region To: Namhyung Kim , Kan Liang , Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-kernel References: <20210322060635.821531-1-like.xu@linux.intel.com> <20210322060635.821531-4-like.xu@linux.intel.com> From: Like Xu Organization: Intel OTC Message-ID: <5fda3599-1b51-5f58-fdcc-2afcf6d4968b@linux.intel.com> Date: Wed, 24 Mar 2021 11:46:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Namhyung, On 2021/3/24 9:32, Namhyung Kim wrote: > Hello, > > On Mon, Mar 22, 2021 at 3:14 PM Like Xu wrote: >> +void reserve_lbr_buffers(struct perf_event *event) >> +{ >> + struct kmem_cache *kmem_cache = x86_get_pmu()->task_ctx_cache; >> + struct cpu_hw_events *cpuc; >> + int cpu; >> + >> + if (!static_cpu_has(X86_FEATURE_ARCH_LBR)) >> + return; >> + >> + for_each_possible_cpu(cpu) { >> + cpuc = per_cpu_ptr(&cpu_hw_events, cpu); >> + if (kmem_cache && !cpuc->lbr_xsave && !event->attr.precise_ip) >> + cpuc->lbr_xsave = kmem_cache_alloc(kmem_cache, GFP_KERNEL); >> + } >> +} > > I think we should use kmem_cache_alloc_node(). "kmem_cache_alloc_node - Allocate an object on the specified node" The reserve_lbr_buffers() is called in __x86_pmu_event_init(). When the LBR perf_event is scheduled to another node, it seems that we will not call init() and allocate again. Do you mean use kmem_cache_alloc_node() for each numa_nodes_parsed ? > > Thanks, > Namhyung >