From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B434C5519F for ; Fri, 20 Nov 2020 15:53:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37F7F22264 for ; Fri, 20 Nov 2020 15:53:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729922AbgKTPxy (ORCPT ); Fri, 20 Nov 2020 10:53:54 -0500 Received: from foss.arm.com ([217.140.110.172]:51500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729562AbgKTPxx (ORCPT ); Fri, 20 Nov 2020 10:53:53 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 07B6111D4; Fri, 20 Nov 2020 07:53:53 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C3BA93F70D; Fri, 20 Nov 2020 07:53:51 -0800 (PST) References: <20201118180030.22764-1-valentin.schneider@arm.com> <20201118180030.22764-2-valentin.schneider@arm.com> <613d0854-597e-6ed7-05ca-70310c7b887d@arm.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: James Morse Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: Re: [PATCH 1/2] x86/intel_rdt: Check monitor group vs control group membership earlier In-reply-to: <613d0854-597e-6ed7-05ca-70310c7b887d@arm.com> Date: Fri, 20 Nov 2020 15:53:49 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, On 20/11/20 14:53, James Morse wrote: > Hi Valentin, > > On 18/11/2020 18:00, Valentin Schneider wrote: >> A task can only be moved between monitor groups if both groups belong to >> the same control group. This is checked fairly late however: by that time >> we already have appended a task_work() callback. > > (is that a problem? It's needed to do the kfree()) > > >> Check the validity of the move before getting anywhere near task_work >> callbacks. > > This saves the kzalloc()/task_work_add() if it wasn't going to be necessary. > Right, to hopefully better point it out: In such cases (invalid move), __rdtgroup_move_task() would trigger a move_myself() task_work callback without updating {closid, rmid}. Given nothing changed (barring concurrent updates), move_myself() won't do any useful work. The task_work_add() and associated alloc could thus be entirely avoided. > Reviewed-by: James Morse > Thanks! > > Thanks, > > James