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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36F09C28B2B for ; Wed, 17 Aug 2022 00:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237903AbiHQANl (ORCPT ); Tue, 16 Aug 2022 20:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235882AbiHQANh (ORCPT ); Tue, 16 Aug 2022 20:13:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D79E2CDCF for ; Tue, 16 Aug 2022 17:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660695213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n9qL/h6uXIAb6VYdRPx1bWna3ld2RQQy7Q8vkiGHtWQ=; b=Nd8hKxBj+icX9SqDWBjtmN7BEamXHs22fLnVNElZ9VoF1dEUmI7zh/pQQBZqdxXJGgAUEc 4X1qeC7zyyNeI5Im8WhVzQt5/oZ01BEfl8duXGFInp/QO9o6+a8C1BxEgHqHrw5sKjC+LS ztcY3iO4qKs285Q2gz3TIZQZUmMwyoQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-tHEhQ5eaPl6ec8C8iEqrAQ-1; Tue, 16 Aug 2022 20:13:28 -0400 X-MC-Unique: tHEhQ5eaPl6ec8C8iEqrAQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CDEE101A54E; Wed, 17 Aug 2022 00:13:27 +0000 (UTC) Received: from [10.22.32.9] (unknown [10.22.32.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DA9140D2827; Wed, 17 Aug 2022 00:13:26 +0000 (UTC) Message-ID: Date: Tue, 16 Aug 2022 20:13:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v5 3/3] cgroup/cpuset: Keep user set cpus affinity Content-Language: en-US To: Tejun Heo Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Zefan Li , Johannes Weiner , Will Deacon , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds References: <20220816192734.67115-1-longman@redhat.com> <20220816192734.67115-4-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/16/22 18:19, Tejun Heo wrote: > Hello, > > On Tue, Aug 16, 2022 at 06:11:03PM -0400, Waiman Long wrote: >> It is hard to synchronize different subsystems atomically without running >> into locking issue. Let me think about what can be done in this case. > I have a hard time seeing why this would be particularly difficult. cpuset > just needs to make the latest cpumask available to sched core in an easily > accessible form and whenever that changes, trigger a set_cpus_allowed call. > There's no need to entangle operations across the whole subsystems. All > that's needed to be communicated is the current cpumask. > >> Is using a sequence number to check for race with retry good enough? > It seems unnecessarily fragile and complicated to me. If we're gonna change > it, let's change it right. Thanks for the suggestion. I think I get what you want. I am going to migrate the cpuset_set_cpus_allowed_ptr() logic into set_cpus_allowed_ptr() itself. IOW, if user_cpus_ptr is defined, it will be an additional mask to be applied on top. It does affect all callers of set_cpus_allowed_ptr() though. I am going to drop this cpuset specific patch. BTW, I will be on PTO starting tomorrow until next Tuesday. So I will be slow in responding to emails. Cheers, Longman Cheers, Longman