From nobody Fri Oct 3 07:42:40 2025 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4A6E1F4168 for ; Thu, 4 Sep 2025 07:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971940; cv=none; b=ojoJARs6jZV03UAZ1MrOPQ6zjbZxkbTsC1VU46rkTzpNh+2HRPSvvIFUPtWTji+T6xDfdl6Uw3WYM13d5mkaFALCc84xpQE6B9t+4IorKWkla2EwlCo7JXn9lzFzNr9YbLc0DTsjJjLp7LM6XZ9Gjc8faj1+rhPQO/y3W1lfY6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971940; c=relaxed/simple; bh=5nFDk4DbTwcgq+XQd78fBU7KRHI5oBKv+saUZCFwnJk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MLIF39EDFAopZuDkiieVCQhcTUV8J9txGbhmuqQQTaEGuiFitTTui50fa4GyI++SFq95QBgxta43574E/Y8W5yBy2B5Qi86Ww3q6Qfxt6M3dZcY6vvkFHp9vgkSXXfA5biENNnRbXB6ewmc2ujias+aULoevrcf7yOAxy8anKi0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=Z4Xa4pAU; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="Z4Xa4pAU" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-24c784130e6so9209825ad.3 for ; Thu, 04 Sep 2025 00:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1756971938; x=1757576738; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BpvqQaG8R1IN33CKrxppIpzXm6RtItfoOaI+A85lf/E=; b=Z4Xa4pAUCGAdVYyEF6n/ojA0TbNdfxrgKTw3/mG122zEKYvjsto8InKhnIcmUYOD5k 2YqxemIZ81GUQmg0GP6IB7r5QyPLDXBGIJWvlvCnOpf/AIebKACKOYYSiEgqQ0jLNapX KRJmKaYM6LADZmlL9ZWXPNlFhJXvJzd2KwNt6brWwGpLS7/9OLRTl29Rv/PmPWt9rJnH w1cb5F6rk0kSFn5/NhkozvRPFfbnNfj/WgTJw3QEApp1ZfD3/ZbxaMAMMeTQXkuBdIgT qqJMAA6ot2/nAJKIWYHU4h+Oyuyguxn/jX+Wzn0e9LkGbq701JTjfpG7jGa3h/mTaALN hA+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756971938; x=1757576738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BpvqQaG8R1IN33CKrxppIpzXm6RtItfoOaI+A85lf/E=; b=pl39i6ewKQnxxYBlK7oE3Ujux9Vkv+xcN+LFf0ByP289NTdpV7g+XKQcYx8khfegc3 ARhKXvAlKO6EcWMDwGQpq9/2oi5MoHetrSpIChhAjPDK5XCs5862whQ7gTkql0yRrmc9 Xt4Ir4PJiw0lPduXyZtvU7zgIvHe8grzyRhLLqUVqjOvQ6JZAFeY5tUt8FvX+2c0nqzr t9hh/168N7z9umz/LZdPzuHUboHyjS8kXeIghY7kalJZf+XGyFiZik4myXMGnP4U1q7i eQKETPLSRc2OdWDWgGwWawn5MKnno8/8EjTCNrJpnqgiB/CKpbstJWL1jyETonXQQb9g 48Kg== X-Gm-Message-State: AOJu0Yxu7oBtxBpTdAwwp79a5aq5146zvqPu9tsyChYdxzFPrWBVf6RG nADZgm0nBWvm9er7Woh3RbYZmB5yGm4DyqOjbu0DK2N+EfMMkbQolWSucIdVey8dGCM= X-Gm-Gg: ASbGncusy75VfQrHt86xJBXCKDjDdHVrCooq1B1Gx/ZyeiR2qKZkHI1iwF5+dnG6mO4 3RmGtOAoqq5jkrXWWI1ud/cftooBVS/zfVq7krbvkUd7XKCn5znn61SfMvdv2asLcS2pRvEzzbK zFfXGtmKmuurPdrD2t807lo4MJa7cBxKipxsloPC5hTamX7ZvyJbqXK8ndbUaPEC9socihQkQ3P aDVbGqjwfLf4biBDXG5Wbo91lA9+mUQuaJrzaDWaBG/zUJ/36sTm8gj6xHGBPZBoL+iA8667CEq /tyKU2r917JO3WXjp+JW7Btk6836VhL629uoq2ZKgWZolh7QMvTjCfP064Fy2Wu9E4UkP2te/bJ yV+3FGEPhD9Abl0H8lsQ1OiKhnUsNZhYXCI1zEzrIBu90I9E= X-Google-Smtp-Source: AGHT+IGZkPhRsNIMH2vOWSfd3g5Lg2fCbRTC9WjNY0j63FcCsXFBdRas5jvKguJfXwUwCjDAAc8LGA== X-Received: by 2002:a17:903:2304:b0:24c:99bd:52bb with SMTP id d9443c01a7336-24c99bd54a9mr55776135ad.30.1756971938008; Thu, 04 Sep 2025 00:45:38 -0700 (PDT) Received: from n37-019-243.byted.org ([115.190.40.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-24b1f7492d8sm63504395ad.129.2025.09.04.00.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 00:45:37 -0700 (PDT) From: Chuyi Zhou To: tj@kernel.org, mkoutny@suse.com, hannes@cmpxchg.org, longman@redhat.com Cc: linux-kernel@vger.kernel.org, Chuyi Zhou Subject: [PATCH 1/3] cpuset: Don't always flush cpuset_migrate_mm_wq in cpuset_write_resmask Date: Thu, 4 Sep 2025 15:45:03 +0800 Message-Id: <20250904074505.1722678-2-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20250904074505.1722678-1-zhouchuyi@bytedance.com> References: <20250904074505.1722678-1-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It is unnecessary to always wait for the flush operation of cpuset_migrate_mm_wq to complete in cpuset_write_resmask, as modifying cpuset.cpus or cpuset.exclusive does not trigger mm migrations. The flush_workqueue can be executed only when cpuset.mems is modified. Signed-off-by: Chuyi Zhou Reviewed-by: Michal Koutn=C3=BD Reviewed-by:=C2=A0 Waiman Long --- kernel/cgroup/cpuset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 27adb04df675d..3d8492581c8c4 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3256,7 +3256,8 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file = *of, out_unlock: mutex_unlock(&cpuset_mutex); cpus_read_unlock(); - flush_workqueue(cpuset_migrate_mm_wq); + if (of_cft(of)->private =3D=3D FILE_MEMLIST) + flush_workqueue(cpuset_migrate_mm_wq); return retval ?: nbytes; } =20 --=20 2.20.1 From nobody Fri Oct 3 07:42:40 2025 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B1132BDC1E for ; Thu, 4 Sep 2025 07:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971942; cv=none; b=i1Xz3YbG2u4m3VbhWKzlBSohh1jNKAQRfn8fj7v2bLfSo7wLGl9OgCJ2zzMEG8iR/QuVs9SMSU9MsSxn2BDasEn4kD4dmGcprMAb2DYRL5ygjwUWHZclZUoEbv45ZPq+K//0sxaulDk5wsv1OpknUkAOd3RxB4a5nDznoqblh/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971942; c=relaxed/simple; bh=wGsiIfQUQg/WTtwMSkaRvIdISfO5jt8VkPbxNhDPvTM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dbcIwwNB8Ra/werFxe3ZjMYSNiudh0dcqO2dGdKjQrM/i1UCpjzIL2l1E8kJcymaujtPAQ+XFRzwcYTbczyhQRgzVXDsj0UMh7X3tmY8CiSSqNUaXjrKnnoLBuREEzYLH0aioECb2hYPXl/HEBlKI6rWhV2KsTzU8RRsgqrE6Fs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=EehghjjK; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="EehghjjK" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-24c786130feso7361575ad.2 for ; Thu, 04 Sep 2025 00:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1756971940; x=1757576740; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fuolykUobTjBETf08U7gHpnXoxj2AwzfcmjE5XBVCYE=; b=EehghjjKij+gVjUuQZ0Bvt3HLFjxT9qXSAQijsrsUdUCEj0oK0yERnXqpL6sFCBgoo mr15VpbnbCNbMEi6hc3xjf7oQwr2/JZZmXMWi7OUO9vML0OmfTy9ZeaKotqAzZM/xuG/ EXBy4BR0CT0CK//5MyXKa3Hfl+yq4JgfisDRGw7QMcsiMD2goW2USqn4KGWlb/drnu1b 6kuv2myv1B67aKpYgMw8CkiPeK0mLJqYfDux4EDYEdVyVBvitkA7B/0kmKLhajE0hQLQ 2y3YcAdusgzrjVb8ezZ5hzDiiJI6strI7gmR7HaXDcyOHLyo7gHRp2UnCysBD2T0uuG7 EEvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756971940; x=1757576740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fuolykUobTjBETf08U7gHpnXoxj2AwzfcmjE5XBVCYE=; b=uBAKX1W8KkW/dRzorlGsYN5EdbgUeskKsatwdhkxtNkV30uMVJFaADl5Hg/y+1QSZu Ci12uOQtj2m2N4MXGiP5Zc+LVBS83w6oY2F60aqtiPsLoHrRi0WeBEtwXZhBr9OVWCJs hOpiBkTFYPgluFjhUJ0hOBdgdR8/z2SzAjTRHtJpBBfM8OiNj5IcsFgmAUBT7uzV9moJ 5hJgJHSz59bP1Whja3Z+gyc2O692Zq9F0hfKHtjvKDjuqH3saQsK3bt2mHWljb0qMCXI 1Plz1W2B+HLbKQFnnh0aPdbtVAzWmMQG5enyg8H24Iy9CMwvgh6JPqGt0/r5LDvlZ3kd J+SQ== X-Gm-Message-State: AOJu0Yy3rUG50ACOuGNg5uH/U0mCRjXvSa93OK24YqDtifoCT4decix+ h4pzQ89URwMGmrzg4K08lTBGmdst7ANLikXRrlVxukIkoKhtspzR3/oKITmujqU1f0o= X-Gm-Gg: ASbGncsQgeAq/8Af6EQ7sDvqmfHixFB3BejJx9QCi+wAFLb+oWYvP2uY3jfdw1vDpwI /0wFTQIt4Tl63lXW2BEcs4YrdMSs9ySS5nfIpuuvWiS5ECzM+AsfBHu7R8zPKnEM1lCC5/OjWsj C2HOAEReXz8g4nYhf0Fz0bTE9FuhI+wU72KLTXLKV0nR7IyCbDv0CA42IHp74V4lbX+eMUPQbxD javCy5MnRGKy6vV1HY986Dbfo37gKO+1YfPXTg+MDX2aB+AWdqKTCZY6fcd3+SbkRXPcIUam+xR f2q3fUzFuUUOB9PlnKzWWj9IFck5mva+bpunYPvTUSytGjTgmakDMqhaslNxn4I7rTU03KqksiI EbJxCni6AHp+dYuLMzQK4qxT5N/lyXWwXdwWWDv0HHDY15nzxc3fu/edJOg== X-Google-Smtp-Source: AGHT+IF4ZwJuiduG/I5ADuH4RiaVQvKpQU8gkjMtOHHk6LOoWCigeGRGz1bm7CC17uoFh4QFPVXteQ== X-Received: by 2002:a17:903:298f:b0:24c:9c29:c9d1 with SMTP id d9443c01a7336-24c9c29cca0mr64320275ad.59.1756971940245; Thu, 04 Sep 2025 00:45:40 -0700 (PDT) Received: from n37-019-243.byted.org ([115.190.40.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-24b1f7492d8sm63504395ad.129.2025.09.04.00.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 00:45:40 -0700 (PDT) From: Chuyi Zhou To: tj@kernel.org, mkoutny@suse.com, hannes@cmpxchg.org, longman@redhat.com Cc: linux-kernel@vger.kernel.org, Chuyi Zhou Subject: [PATCH 2/3] cpuset: Defer flushing of the cpuset_migrate_mm_wq to task_work Date: Thu, 4 Sep 2025 15:45:04 +0800 Message-Id: <20250904074505.1722678-3-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20250904074505.1722678-1-zhouchuyi@bytedance.com> References: <20250904074505.1722678-1-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now in cpuset_attach(), we need to synchronously wait for flush_workqueue to complete. The execution time of flushing cpuset_migrate_mm_wq depends on the amount of mm migration initiated by cpusets at that time. When the cpuset.mems of a cgroup occupying a large amount of memory is modified, it may trigger extensive mm migration, causing cpuset_attach() to block on flush_workqueue for an extended period. This could be dangerous because cpuset_attach() is within the critical section of cgroup_mutex, which may ultimately cause all cgroup-related operations in the system to be blocked. This patch attempts to defer the flush_workqueue() operation until returning to userspace using the task_work which is originally proposed by tejun[1], so that flush happens after cgroup_mutex is dropped. That way we maintain the operation synchronicity while avoiding bothering anyone else. [1]: https://lore.kernel.org/cgroups/ZgMFPMjZRZCsq9Q-@slm.duckdns.org/T/#m1= 17f606fa24f66f0823a60f211b36f24bd9e1883 Originally-by: tejun heo Signed-off-by: Chuyi Zhou Reviewed-by:=C2=A0 Waiman Long --- kernel/cgroup/cpuset.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 3d8492581c8c4..ceb467079e41f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -40,6 +40,7 @@ #include #include #include +#include =20 DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key); DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key); @@ -2582,9 +2583,24 @@ static void cpuset_migrate_mm(struct mm_struct *mm, = const nodemask_t *from, } } =20 -static void cpuset_post_attach(void) +static void flush_migrate_mm_task_workfn(struct callback_head *head) { flush_workqueue(cpuset_migrate_mm_wq); + kfree(head); +} + +static void schedule_flush_migrate_mm(void) +{ + struct callback_head *flush_cb; + + flush_cb =3D kzalloc(sizeof(struct callback_head), GFP_KERNEL); + if (!flush_cb) + return; + + init_task_work(flush_cb, flush_migrate_mm_task_workfn); + + if (task_work_add(current, flush_cb, TWA_RESUME)) + kfree(flush_cb); } =20 /* @@ -3141,6 +3157,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) struct cpuset *cs; struct cpuset *oldcs =3D cpuset_attach_old_cs; bool cpus_updated, mems_updated; + bool queue_task_work =3D false; =20 cgroup_taskset_first(tset, &css); cs =3D css_cs(css); @@ -3191,15 +3208,18 @@ static void cpuset_attach(struct cgroup_taskset *ts= et) * @old_mems_allowed is the right nodesets that we * migrate mm from. */ - if (is_memory_migrate(cs)) + if (is_memory_migrate(cs)) { cpuset_migrate_mm(mm, &oldcs->old_mems_allowed, &cpuset_attach_nodemask_to); - else + queue_task_work =3D true; + } else mmput(mm); } } =20 out: + if (queue_task_work) + schedule_flush_migrate_mm(); cs->old_mems_allowed =3D cpuset_attach_nodemask_to; =20 if (cs->nr_migrate_dl_tasks) { @@ -3257,7 +3277,7 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file = *of, mutex_unlock(&cpuset_mutex); cpus_read_unlock(); if (of_cft(of)->private =3D=3D FILE_MEMLIST) - flush_workqueue(cpuset_migrate_mm_wq); + schedule_flush_migrate_mm(); return retval ?: nbytes; } =20 @@ -3725,7 +3745,6 @@ struct cgroup_subsys cpuset_cgrp_subsys =3D { .can_attach =3D cpuset_can_attach, .cancel_attach =3D cpuset_cancel_attach, .attach =3D cpuset_attach, - .post_attach =3D cpuset_post_attach, .bind =3D cpuset_bind, .can_fork =3D cpuset_can_fork, .cancel_fork =3D cpuset_cancel_fork, --=20 2.20.1 From nobody Fri Oct 3 07:42:40 2025 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45D491F4168 for ; Thu, 4 Sep 2025 07:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971944; cv=none; b=ebtStZkxoMaVkO58us/FyqBk7ORfa2ZrhI+mXej2hZyq/hhW+b4p1OPqqfVtDFs7NUCxB8DuXU9AbR+cGp1vT/2JH6qQoDVdBsnGNIq+grR7Oogo+uTwml629PMMRyP1+Bo/zRIaVHA6q3GlF/HergAl7eBrFfLa+4oEwbxke4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756971944; c=relaxed/simple; bh=mwVo5BvCGfBrvtywIF3km/HSbNwqZiXe2Hw6huMBRVI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LetEmo9bGoco56ppDu8oFSLY2gblPbvNgUiw1UcgYC5eML6EE39mTKpDC+JL5vvJLJNE3CWzEnhVMG2feunYCo4UKlVSDguId9RItPpJ+xAjfANwc915QcHFAY1QbJzqYMewCzw6RFbKZK+uJ4dQUpnc7aW/ubQPA/tW7FQHUQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=CKMsiHMO; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="CKMsiHMO" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-b4c3d8bd21eso420946a12.2 for ; Thu, 04 Sep 2025 00:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1756971942; x=1757576742; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lwSifmMVhfrKYyAfWULyU3wfJ1S9Le3WIslBvHhnZRY=; b=CKMsiHMOjz7+Yfo7ec4H7W8wdZPosztZNIv3XB2yCNgi7/2ytik+qt3rJfwCZS36/x SsiQylzvfeW7d45f5uPoDrQPHH1SC80j+Zi0xhQWrIb5hrIpjqHO3YP5DjwLTLnNSDuq thPSUAjtl1LewbYVvA6YB/OSSH9jJr2/lvgKyxaHIoPdtdpo/7AAxBCIS1r982BUs9sJ iPDHnbnaC0Lm7T99uSyI/UEixMUI+gi2idEG9Ir+D3NVucAW6mair76aowSjVw4QNlvJ ElvgouD2qYNEEE2B94XqQCDZxQbI6cLtzaLPnxY05mIbmnEU2AL9hTKwOKKa13jTGLzw tQng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756971942; x=1757576742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lwSifmMVhfrKYyAfWULyU3wfJ1S9Le3WIslBvHhnZRY=; b=VOcZu9jGodffiy/xB59v5DjB0Z0amQt/5gCpFG3jtUFlF6rPtqEwLGibRwjkou1E7r Icpbbo7HMem6N7o7uoZTwafqoOqG1W2f2tWRPFGgQwg+KRJX/rc/g2y9BsQVa8fMacqt bGIGb8uqDRttVHkdWUhvqyXj8YU02j2d5DPe2vyzfihEnXyuEEOgsAytGjyXRIPwYAmB 7lUOs0lIjIF/gpdsRhbXPdtZZC0pYRmruwSd3kspT0b6iTE9Rjrup9BmmnD3ADOSHUOu ei7lwkDJtxP8EtXa13ghk9P8oeLhfA6Xha6Zqu0u0O8wkxSdBVSUsDMhTX1oiw9N6vKq wnvg== X-Gm-Message-State: AOJu0YyzvSq4JOnUsP1GC5ATsLIuB0MgtyTmJ0pppXLMBNORhqjzUJO5 50pybgsxEVxA1M7aljx3Mr+LgQwTQJgwKobeHLnGJqC6bRKyOxKt1RJ8DB7T6gIHCW8= X-Gm-Gg: ASbGncv6ar7Lh4CXD3yPfJol8R288hPPdZnKK8Qy4C0a7vs/D6kIO18Keq5aPlKo4eg uInUHHjMxQSNZlujdPPPKvYnzfnT5YMw+LI+qJtslwDAkHLrMtP24JhSITUj6Vjg5QRZkPd5YnP fg3XJ75C5OxGLC2Dkjj/b8Q3rH9WBBwZfxpycajdYFqRZXgLgRRrzWVayr/F2w7GmIA+67SHKCW 9ed3f0eO4iPd2vin4wcx8r6jl407XRpm24BaJ1MnvTxQ9mQVDUVPiQMfEq+NEO7v1PWlLy/UwoC p2HPSX9u3d0bf9Y1w4tlEDiI+oRsrwtAw6TDGKCAWadoSyyqdaIb8J6Wx58qNg8QWnS5IqQ0ocv 8KokmKEL+vjjdV+k+8VHRjWkzYm0rxrrXWQrjIPX6QpZmdkc= X-Google-Smtp-Source: AGHT+IFX4EjymSq0f8f1JxLjejSSfBxljLJBopRSZmFliuv880srE/4QP2txO60+lbu/wT5uhlsYEA== X-Received: by 2002:a17:902:f549:b0:24b:e55:34b with SMTP id d9443c01a7336-24b0e550987mr145495995ad.31.1756971942481; Thu, 04 Sep 2025 00:45:42 -0700 (PDT) Received: from n37-019-243.byted.org ([115.190.40.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-24b1f7492d8sm63504395ad.129.2025.09.04.00.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 00:45:42 -0700 (PDT) From: Chuyi Zhou To: tj@kernel.org, mkoutny@suse.com, hannes@cmpxchg.org, longman@redhat.com Cc: linux-kernel@vger.kernel.org, Chuyi Zhou Subject: [PATCH 3/3] cgroup: Remove unused cgroup_subsys::post_attach Date: Thu, 4 Sep 2025 15:45:05 +0800 Message-Id: <20250904074505.1722678-4-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20250904074505.1722678-1-zhouchuyi@bytedance.com> References: <20250904074505.1722678-1-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" cgroup_subsys::post_attach callback was introduced in commit 5cf1cacb49ae ("cgroup, cpuset: replace cpuset_post_attach_flush() with cgroup_subsys->post_attach callback") and only cpuset would use this callback to wait for the mm migration to complete at the end of __cgroup_procs_write(). Since the previous patch defer the flush operation until returning to userspace, no one use this callback now. Remove this callback from cgroup_subsys. Signed-off-by: Chuyi Zhou Acked-by:=C2=A0 Waiman Long --- include/linux/cgroup-defs.h | 1 - kernel/cgroup/cgroup.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 6b93a64115fe9..432abdfdb2593 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -746,7 +746,6 @@ struct cgroup_subsys { int (*can_attach)(struct cgroup_taskset *tset); void (*cancel_attach)(struct cgroup_taskset *tset); void (*attach)(struct cgroup_taskset *tset); - void (*post_attach)(void); int (*can_fork)(struct task_struct *task, struct css_set *cset); void (*cancel_fork)(struct task_struct *task, struct css_set *cset); diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 312c6a8b55bb7..75819bb2f1148 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3033,10 +3033,6 @@ void cgroup_procs_write_finish(struct task_struct *t= ask, bool threadgroup_locked put_task_struct(task); =20 cgroup_attach_unlock(threadgroup_locked); - - for_each_subsys(ss, ssid) - if (ss->post_attach) - ss->post_attach(); } =20 static void cgroup_print_ss_mask(struct seq_file *seq, u16 ss_mask) --=20 2.20.1