From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793719366; b=l6hpnZ24DYROYUFNnovmKyppvs3OnuAsTFu7GugIPqbpe5oC7Nwq8x2qtRT26bTtKF5D YXWrHXStXdPRRFpV5Vyhrt3kFXFbRFlr3VlrH8sL748PT624wY9lW+wjocfth+AXwmaDu RN+4YlGDp0Nx+1gJtokIg+hVogj02UJknTWxPWcwEbggMrkdEc3rBjB0v56OXBkvfx8SN 9H+qg8uTQFY1Ghl0W0DDLC7hQAor6wa+OPey20N+iiqIz5WD+uQBa4dhQ/jY04UhWvMdj p6Csc9L2hP+naFQ0xRycQItcdI2tQnt43Z+8n9N1VCWLOfiCYCuh0O+LqLq2NCm5CqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793719366; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Scanned-By; bh=4+H98LPenOtXM20iyFs2uc1o5Gjvbk6CvWIcoeiCnUk=; b=FwCj1qTQdHpzHx+3rvrNG6cXvtuiN3RkajPcjukMjhmgYpIjf8FP8zNVhhHriRuXS2Gf 0RLVAbcpFBQR3fNWueulpy5+ckIe62yHv8EOEv4EbSAVnln9gRQzHEeGNttIX4v4ZVshp 3z2YzUXAoY+qUz8wlhJ0VUoJ8kWde0FQBlm1Y9I+qkasWmKrdFCKX0r780wwjh6A4bgWK xkGGrLH7wDQIFh3OsI8EzRfVnvtUtLgvF2/dQFQFTktn52f+rKKnzZyl40vnWeNgR3z5y QpXahR2ypPBVWMhT9odzQSfsrWDAzwcQ4BTzXcf6Nso4GME615r4/EmWiUxps+IIAtw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b="Iu/eUn1W"; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B673C606A7A0 for ; Tue, 3 Nov 2026 15:22:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B673C606A7A0 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, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Iu/eUn1W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793719364; 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=4+H98LPenOtXM20iyFs2uc1o5Gjvbk6CvWIcoeiCnUk=; b=Iu/eUn1WYtB4MmUYpENh4yto/cqyDYmMP/wdyZ8Z8b7cfZ7B8P36YtJiZfu3tGUoWBUqOH 3sykg3G5yaENEBraxzCGdubsI44dz1zTejNiXGQ86rs90YerukezsOY1cXaLC6iMjAA54h 0tAN/SMjQRUUL8kFtkEZA29qUzBi2rw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-ZpBEt-W5O6Gb3NzZNS-d9g-1; Tue, 03 Nov 2026 10:22:41 -0500 X-MC-Unique: ZpBEt-W5O6Gb3NzZNS-d9g-1 X-Mimecast-MFC-AGG-ID: ZpBEt-W5O6Gb3NzZNS-d9g_1793719357 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DA50219560BF; Tue, 3 Nov 2026 15:22:35 +0000 (UTC) Received: from [100.91.18.181] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C78C26C; Tue, 3 Nov 2026 15:22:30 +0000 (UTC) Message-ID: Date: Tue, 3 Nov 2026 10:22:29 -0500 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/6] cgroup/cpuset: Don't wait for memory migration when cpuset.mems is written with O_NONBLOCK To: Tejun Heo , Matthew Ruffell Cc: Frederic Weisbecker , Peter Zijlstra , Ingo Molnar , Andrew Morton , David Hildenbrand , Caron Wills , Ridong Chen , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jay Vosburgh References: <20261103075940.110308-1-matthew.ruffell@canonical.com> <20261103075940.110308-6-matthew.ruffell@canonical.com> Content-Language: en-US From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 On 11/3/26 9:59 AM, Tejun Heo wrote: > On Tue, Nov 03, 2026 at 08:59:39PM +1300, Matthew Ruffell wrote: >> From: Caron Wills >> >> Writing cpuset.mems migrates the memory of every task in the cpuset on >> the ordered cpuset_migrate_mm_wq, and since commit 3514309e0322 >> ("cpuset: Defer flushing of the cpuset_migrate_mm_wq to task_work") the >> writer flushes that workqueue from task_work before returning to >> userspace, so that the write appears synchronous (the design of commit >> e93ad19d0564 ("cpuset: make mm migration asynchronous")). The writer >> therefore sleeps in TASK_UNINTERRUPTIBLE for as long as all queued >> migrations take. On a system with isolated CPUs running SCHED_FIFO tasks >> that was measured at 2 to 10 minutes (LP: #2165410), and it is unbounded >> in principle: a migration blocked behind a starved kworker or a slow >> expedited grace period holds up every migration queued after it. >> >> The writer is usually systemd. It applies AllowedMemoryNodes= from PID 1 >> itself, and since v259 it opens every cgroup v2 attribute file with >> O_NONBLOCK precisely to opt into asynchronous semantics wherever the >> kernel offers them (src/basic/cgroup-util.c, cg_set_attribute(), citing >> the memory.max/memory.high behaviour of commit c8e6002bd611 ("memcg: >> introduce non-blocking limit setting option")). While PID 1 is stuck in >> the flush, logind cannot create sessions and SSH logins fail. >> >> Honour O_NONBLOCK the same way memcg does: skip the task_work flush when >> the file was opened non-blocking and let the migration complete in the >> background. Blocking writers keep the synchronous behaviour and the >> cgroup.procs attach path is unchanged. >> >> This does not make the migration any faster; it only stops the writer, >> in practice init, from being held hostage by it. >> >> Link: https://bugs.launchpad.net/bugs/2165410 >> Signed-off-by: Caron Wills >> Signed-off-by: Matthew Ruffell > This makes sense to me. Waiman? > > Thanks. Yes, that looks good to me too. Maybe, we should also update the cgroup-v2.rst to list the condition when synchronous waiting will be skipped when updating cpuset.mems as it is a behavioral change. Cheers, Longman >