From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8954B72617 for ; Mon, 24 Nov 2025 04:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763958303; cv=none; b=tu6u4JMrjVN7oqKqbhWU0vKCD0KJK5HpMT/6eI1x+jF4V5humXUV30FFync5RFiSdXLF03mGyT4injbBgEM0MxG/L+2je1OF/NOq5FBtjj73klHjVBDqmqoChoSu/lBGusASQyt1F3FKOSdcVEzrIZvJE2Ez98x7jOioLvcvnGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763958303; c=relaxed/simple; bh=qgyowIFIL9LEITJavk7MmPCoyxmE7L0WxAzCZgZgECQ=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=RIpKOO64e5RQO2T0GQsfWXYSvtBFkCvQOacncHVuDeWxNMySnsiiaoXLHvVWcZlB+OCGgijn/eMB6qadwTUOwqueUmcnLJW3wU0Em4qaYESMbCK6AfP/5U2Ejt7WhzSWUUZIw2biKqpzfWbYxLT7vlbHwmm096wUJo9oDQe1Lzg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jHSEReiV; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=UABhw/kx; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jHSEReiV"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="UABhw/kx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763958300; 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=zzdBqPVfq56pzplAbMw6RgwBuXv/gnMgwtXqhsoThNo=; b=jHSEReiVJB3Cw7YuhGXiL0MO0v1JhGFm10W0iT0VGsxgMg3Nvf56gA9Ac9B5q/fRSZuNMe ubVygjaq+6tCyagzaKdbv+v2vHCLZL1juWbQ19/ZXNTyCmWn+YBSSIxkRS0NftEDbzIsbC uB92FcdUEVlaFDSyfaMzwBbIrTWS3xg= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-522-xw12NgPTNHKNfTrGl_PvVA-1; Sun, 23 Nov 2025 23:24:59 -0500 X-MC-Unique: xw12NgPTNHKNfTrGl_PvVA-1 X-Mimecast-MFC-AGG-ID: xw12NgPTNHKNfTrGl_PvVA_1763958299 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-880501dcc67so172545226d6.3 for ; Sun, 23 Nov 2025 20:24:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763958298; x=1764563098; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=zzdBqPVfq56pzplAbMw6RgwBuXv/gnMgwtXqhsoThNo=; b=UABhw/kxEzssaViFKHu0AWeYKs08jYDYQf76gGg+mqOMr1Mdg4E290ZymK73ja8GKT Pba1bsInddG31qgwihk/O0PJGeS/rxQxBD+IJMxKeJ84DkIFWteitn8IuWY101KY61LF pzzJjQ85jSog3GChzj3wo4dz1tKR0xOnhCoRBOl+rGYtNGvATYmUvxdterKqfvf9DQoZ i8Xfv537DGRLOy1TyF/gaDyAvmhMmU3p+x1E5BbieGXLp5yHImFmcV8EuZQ4xbuUblsd A1qIFzNTAv+5HfaegbpRSG+HxhCFPfSQthI4vp4O/vmla2PmJD+R+LzpRA0XftQ3wSRp pHzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763958298; x=1764563098; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zzdBqPVfq56pzplAbMw6RgwBuXv/gnMgwtXqhsoThNo=; b=TSqtSTQHjH33zOuASCrCLKgZC4XOxvYPlUcRVyFuFtodTV3sjb7yv3YRkjNv6bEUDT A7FhF+CeEUm7XI/XUU13tK9MlVF0E/JHnOXJ2sitzeuoVKtCv15nGUsq6q/wUIQCi5TS UUyUstdguOD2JRgAtYlFOP7gu5kyOSRz7ES0s/BZ2A69qchdGjLBsL5d0/jIwmgOnoSn h1c/jC+qlvUT8qdis5IF17EsBeabQdgmZI7cUQZcIv7qFyf/IwfAeTWMpXfM+uMOsPPW W2nKP8/9RQ1gczSrlM4/uDre+X2PH1cJaqAmIcYHgQr+GyjcWqebDlv7wimH+7dtlWU/ lwyA== X-Forwarded-Encrypted: i=1; AJvYcCVflWxUbXVoXR6OIA2LfC2Bl9LgFOkh6qtzx+pF4JQUPDBeBXoQr7We8KTaD1wNBybJkbeJStziK9Uoh+U=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv3S91RhxsJPkRKSNNygZHi/53GV7Z57e7R2H7FX/f8V9H4kYI wXBIgeInZUxZkdczGU6+mcz2h14bMziY7hbDLnS1cHGTev/RTJuzLhFpzGFgyqOh9GDtpwy4PWG VabeInbhE0Fmj42TYY28PN/nn0Sl387t4vL+0/PFoK6OBIrTDIq96opKBFat8FT1J8g== X-Gm-Gg: ASbGncu5OpySP+ubLTs8KW2Y+N8KXquRMcPvVGWzkYYBtsiVCM5iygH5fLKmo1L8Q0G yJcpQxefhtXuh/wfXMJtfBgy2/HI9/8ms0eL66D+QOdKRNPmGHDj60TAlJLZih+APo+Ox/V1+Pa T2IKEdkieCf9Z5k6iMjo0J7z50FQDIkYiDnPIrpxgau4fmEEkOcsUl/zfaKMzVi2iQ6cO+fLJDf uaLyYCd4TuhC/Z0Sz73G88CnxbFmeov+q7Ks6WUhYjwjSrOO8/OUs9gO5wUzHJQMQUtf9j4y5V5 fst+aYAlFdyjYzPa9GM+rRO3oGzH2XDUrwG1llhrVuqWh8tLNdfTisoLxNEV9nljIvS/Vb4R8ql Q1XaQnIJi5PvWE01O31DwKDbw4PEFCUwmAt80jsf//+795GRrTbr/7eA8 X-Received: by 2002:a05:6214:590c:b0:880:4c02:c4d with SMTP id 6a1803df08f44-8847c53b951mr146563786d6.66.1763958298574; Sun, 23 Nov 2025 20:24:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaFzTcXH6QWa7fGMjn9CjzCZCHF63Y+JrqAFu+E+GSY0XjFj2jroufHF8rct/1ooX7DInMoQ== X-Received: by 2002:a05:6214:590c:b0:880:4c02:c4d with SMTP id 6a1803df08f44-8847c53b951mr146563666d6.66.1763958298125; Sun, 23 Nov 2025 20:24:58 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8846e54c032sm92193946d6.36.2025.11.23.20.24.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 Nov 2025 20:24:57 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <54ccf6b4-8ad1-4954-84ba-6d1bf7b5bd65@redhat.com> Date: Sun, 23 Nov 2025 23:24:55 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug To: Pingfan Liu , Waiman Long Cc: Juri Lelli , linux-kernel@vger.kernel.org, Chen Ridong , Peter Zijlstra , Pierre Gondois , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tejun Heo , Johannes Weiner , mkoutny@suse.com References: <20251119095525.12019-1-piliu@redhat.com> <20251119095525.12019-3-piliu@redhat.com> <0f57e7df-c45b-4c25-856b-4dd240f8d717@redhat.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/23/25 10:56 PM, Pingfan Liu wrote: > On Mon, Nov 24, 2025 at 10:24 AM Waiman Long wrote: > [...] >>> Currently, all cpuset locks are encapsulated in >>> kernel/cgroup/cpuset-internal.h. I'm not sure if it's appropriate to >>> expose them. If exposing them is acceptable, >>> cpuset_callback_lock_irq()/cpuset_callback_unlock_irq() would be >>> preferable to cpuset_mutex assertion. >>> >>> @Waiman, @Ridong, could you kindly share your opinion? >> The cpuset_cpus_allowed_locked() already has a >> "lockdep_assert_held(&cpuset_mutex)" call to make sure that >> cpuset_mutex is held, or a warning will be printed by the debug kernel. >> So a check is there, it is just not in the deadline.c code. The >> dl_add_task_root_domain() is called indirectly from >> dl_rebuild_rd_accounting() in cpuset.c which does have an assertion on >> cpuset_mutex. >> >> There is an external visible cpuset_lock/unlock() to acquire and release >> the cpuset_mutex. However, there is no public API to assert that >> cpuset_mutex is held. There is another set of patch series that is going >> to add that in the near future. At this point, I don't think we need to >> have such an API yet. I will suggest adding comment >> to cpuset_cpus_allowed_locked() that it will warn if cpuset_mutex isn't >> held. >> >> Providing a cpuset_callback_{lock|unlock}_irq() helpers may not be >> helpful because we are back to the problem that callback_lock isn't a >> raw_spinlock_t. >> > I meant to put them outside the pi_lock, so it can reflect the > original purpose of this section -- cpuset read access instead of > write. But yes, I agree that at this point, there is no need to > introduce a public API. By putting it outside of the pi_lock, you may as well just call cpuset_cpus_allowed(). Cheers, Longman >>>>> void dl_add_task_root_domain(struct task_struct *p) >>>>> { > [...] > >>>>> + /* >>>>> + * Get an active rq, whose rq->rd traces the correct root >>>>> + * domain. >>>>> + * Ideally this would be under cpuset reader lock until rq->rd is >>>>> + * fetched. However, sleepable locks cannot nest inside pi_lock, so we >>>>> + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' >>>>> + * to guarantee the CPU stays in the cpuset. >>>>> + */ >>>>> + dl_get_task_effective_cpus(p, msk); >>>>> + cpu = cpumask_first_and(cpu_active_mask, msk); >>>>> + BUG_ON(cpu >= nr_cpu_ids); >>>>> + rq = cpu_rq(cpu); >>>>> dl_b = &rq->rd->dl_bw; >>>>> - raw_spin_lock(&dl_b->lock); >>>>> + /* End of fetching rd */ >>>> Not sure we need this comment above. :) >>>> >>> OK, I can remove them to keep the code neat. > @Juri, sorry - I need to send out a fix that should be simple and > focused: just the fix itself, without removing the comments. So I have > not removed them. Anyway, they can remind us this is an atomic cpuset > read context. > > > Best Regards, > > Pingfan >