Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp173904pxf; Wed, 24 Mar 2021 02:11:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYjmgfFzO6Chq5CNq9cOHXXlcDq5Vk428E1yMMwTBQ1ixH3TIrhd7qFMdZbBAnCnOQfX9c X-Received: by 2002:a05:6402:3587:: with SMTP id y7mr2457262edc.54.1616577118300; Wed, 24 Mar 2021 02:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616577118; cv=none; d=google.com; s=arc-20160816; b=ylqlYcyxrlx4bTr8WoPFQ1FuA13BMVpN6AOZBU742m8qQBqZC84CdYRY7a3tPUCmDC B5SpCuMmYudokF3Ki5apkeSdD9bB3eulUjf10Kn5DeM+aiaclmjAUhpFMZTdpI7j8FuU i8fRVIx1MDLgROURFz4lwJF8bjMmD+3+JWXv7klri2lpvv67nYY98k2O26kHiyFeLf0q ++yOve2Cmh+5fSbF1FuTYq49nohf4vU1PCHn/NOAg3BCiTI5P0hrN1KYzDz2IrYET5mP lPbg7dGFNwPJVufrn6dmvVAhJJ3FbnQNzd+6S+PvPw/pVjjcKgYDX/1BfQdIMRVRp3nA Oaow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=TPlGyuHsYMTFJdo8mnBoWVUnbHgk6ZshI4ErqXjbjMo=; b=0UchMjOHUMN8UdcjUG6xh1rTibrTCc29SzTcrnlp4dsVLMZwW2LxHObo8m1aOP/4oL tOXTiVaWLhw5NZkLKw8fEOHssaKyZNo3KK7LLfCb/R+oRK+850/BKCrZbEtHQ+rOjhjB DZG/F9DjKl89qceOjDHC4d+ZzQ0Fntnx0YeOLiZVEsaQcKTRCJiL2nghDTkJfalTS+WH DLnA39SJ6KlOyQno3U1Nr9RD/BWXK6x9MBSQ4ZpGzQ6g9RRb8L/xLn4Q4dfzXekQg5cI EAtWXEioXs5hyCBW+yrmgZpfDk70zymf8BZN0nr8cpb/mRwd/90TI+/eiKRQy2SKshqe 8AVw== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ju25si1320225ejc.668.2021.03.24.02.11.35; Wed, 24 Mar 2021 02:11:58 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbhCXBdU (ORCPT + 99 others); Tue, 23 Mar 2021 21:33:20 -0400 Received: from mail-lf1-f54.google.com ([209.85.167.54]:41606 "EHLO mail-lf1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234728AbhCXBcx (ORCPT ); Tue, 23 Mar 2021 21:32:53 -0400 Received: by mail-lf1-f54.google.com with SMTP id b14so16251433lfv.8 for ; Tue, 23 Mar 2021 18:32:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TPlGyuHsYMTFJdo8mnBoWVUnbHgk6ZshI4ErqXjbjMo=; b=OpRHBaPYEIJNhnT54ZnhgdaCALWJhzcebpVnHhL4+p0U1lF/nMoChYIIfq9jDgUEB1 F5pXsOw0iZ9LvQ3fEhR1NHriNzcfcH5uM84XbBIfr/2BaQQ4Ll/ZlhGz2ClTtAbgqnJ1 A6une68Dx9/f9tihnbEvxHRS6NbyDUzOiibiXzqWBXsZ7PIxdjhq7NhjlAvlkmH4FogG JFtbt4Ko+Hn3oZmajn5dfSrtnIjV769snC2G9voWgOK+ursjvSdR6nwYWD+yJ0ISVG35 HXjkQi7b71XhY/M49m7hBWWdyzjjr7+R6xXFe9Q8cFrNvccnEqX8JuaWvsC4cGtzbrza mUOQ== X-Gm-Message-State: AOAM532/2D21K21EXzXlsbHE6km6M7ythImUE3NdfQX4RJKX7i6Osbqm oiuzgscdjXcRU9gxO6exjec2wDfNaAlLaF3dhEo= X-Received: by 2002:a05:6512:36c8:: with SMTP id e8mr427590lfs.635.1616549572493; Tue, 23 Mar 2021 18:32:52 -0700 (PDT) MIME-Version: 1.0 References: <20210322060635.821531-1-like.xu@linux.intel.com> <20210322060635.821531-4-like.xu@linux.intel.com> In-Reply-To: <20210322060635.821531-4-like.xu@linux.intel.com> From: Namhyung Kim Date: Wed, 24 Mar 2021 10:32:41 +0900 Message-ID: Subject: Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region To: Like Xu Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Thomas Gleixner , Borislav Petkov , Kan Liang , x86@kernel.org, linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Thanks, Namhyung