Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2276066pxb; Mon, 11 Jan 2021 05:50:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6NFye5bB2+xoCozgMKRi3AIl/nkHZ3NdijvjPwvuK1bmS45N/U82Po2Q0k+v7SXft/Jmp X-Received: by 2002:a50:b944:: with SMTP id m62mr13955037ede.182.1610373033900; Mon, 11 Jan 2021 05:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610373033; cv=none; d=google.com; s=arc-20160816; b=X4b2XOzuSulicBdAvxea3hCsrz4UUTKvdk2ZCkJ5qt+vHG7OU7gjuZ4D9h8A9zGeHx Z1ujPBvsM0nrGVaM9njwVWna7TEbkkKapV89nnABx/AgzxQE0oXUe6lPGy5PZ9ATNI+b vni1yNe1Xt+usMvLq6iHASUqo3Jm2MKzzo8WaTtN16VzdD3sFT2Zr/9GZvobVuoGBf2j aUZyvT5+onFvja1ipToklk8W91Yu4gab73ZIwOTeTv4rR+DuKQd+KTb7WMe1CLfevL98 BJw/EOKHDKO4VVNyGQzlNK9lrIFaH0pH1zFfu6DlqBax+VvIlmShXtn6TQU2xa35oG+G T7bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p7j0kQ4TyqE4LM1WC7vAVspBSFdXCLyh1XazDNbfJjc=; b=R4XbKkebD3TIYX7JhD9j3MqrStWxgyIo3gta2sL1nldgyKp4AvMWOkgUbI3t31C04y WDlY4PRlLbinbQ/24vMv+GT7Gk6aJ13BSomEm4muE1r3yrxX16Dzmw2pm/hvyleZWsJ8 ZgkVa3aecxqz/yIXt63iPrhq9kN+ynRXW3fRUElBjvxce4VZf+OU2B80z++Lygoy0u/m jb8PvK7pJe9OGdU4XdbOqSbFEYgJFEFSA9Co+ATvExMYj07nflqYA7fTNjr5cs7meV/c 90uBPGaLdWGAJ8yWX8gth2gfLKSCz895MELKIWVci2OONca0CDzxB0/4YySgSUzr19HH uk8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yo21lXNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si6460567ejn.17.2021.01.11.05.50.09; Mon, 11 Jan 2021 05:50:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yo21lXNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387549AbhAKNrj (ORCPT + 99 others); Mon, 11 Jan 2021 08:47:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:57630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731169AbhAKNKY (ORCPT ); Mon, 11 Jan 2021 08:10:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB25F22AAF; Mon, 11 Jan 2021 13:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370584; bh=ZUPoPv1DrRYBjzg/5+aEgA4OUgxU5r7rYrliBWfzLgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yo21lXNSFmADYwJ1wsAuj2G0w58HJ1w9ihDsvFtP6xXDNVzZc4emzEYs9AJjqYE1s UsriDVLSrds0JrGHHu3n+uVO9CMQKDCQNzozDYEuYOIwePgg92ZZXU5MrfpLn/PBXi C+ppe1bqWFTsB5Bx6afINnv2yiBAhcPO3xFolqos= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfeng Ye , Lai Jiangshan , Tejun Heo , Sasha Levin Subject: [PATCH 5.4 01/92] workqueue: Kick a worker based on the actual activation of delayed works Date: Mon, 11 Jan 2021 14:01:05 +0100 Message-Id: <20210111130039.226222908@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunfeng Ye [ Upstream commit 01341fbd0d8d4e717fc1231cdffe00343088ce0b ] In realtime scenario, We do not want to have interference on the isolated cpu cores. but when invoking alloc_workqueue() for percpu wq on the housekeeping cpu, it kick a kworker on the isolated cpu. alloc_workqueue pwq_adjust_max_active wake_up_worker The comment in pwq_adjust_max_active() said: "Need to kick a worker after thawed or an unbound wq's max_active is bumped" So it is unnecessary to kick a kworker for percpu's wq when invoking alloc_workqueue(). this patch only kick a worker based on the actual activation of delayed works. Signed-off-by: Yunfeng Ye Reviewed-by: Lai Jiangshan Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/workqueue.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 4aa268582a225..28e52657e0930 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3718,17 +3718,24 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) * is updated and visible. */ if (!freezable || !workqueue_freezing) { + bool kick = false; + pwq->max_active = wq->saved_max_active; while (!list_empty(&pwq->delayed_works) && - pwq->nr_active < pwq->max_active) + pwq->nr_active < pwq->max_active) { pwq_activate_first_delayed(pwq); + kick = true; + } /* * Need to kick a worker after thawed or an unbound wq's - * max_active is bumped. It's a slow path. Do it always. + * max_active is bumped. In realtime scenarios, always kicking a + * worker will cause interference on the isolated cpu cores, so + * let's kick iff work items were activated. */ - wake_up_worker(pwq->pool); + if (kick) + wake_up_worker(pwq->pool); } else { pwq->max_active = 0; } -- 2.27.0