Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp941458imn; Tue, 26 Jul 2022 13:42:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tpd6sZhmPDWDRLujjJwTokKBYmNoZfrL/pP/Zmln1uXLEeeKJwtkqP1/1CaTYF5ju7nGzT X-Received: by 2002:a17:907:3e0e:b0:72b:568f:7fa7 with SMTP id hp14-20020a1709073e0e00b0072b568f7fa7mr15924613ejc.119.1658868177207; Tue, 26 Jul 2022 13:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658868177; cv=none; d=google.com; s=arc-20160816; b=R4VKEljk/kq4PFC2a9twMav8pS0DXfpMkLWJs9ion/tFhT8tmCIFj3OPQSIJxspJpi gpxca7NQHFQhKRz8UhLQERkbDTxgci/topB1oZUjatvBdTULcAlgiJZzyxkIVC1EM2g+ +lBgo+BullNRnHstuKoRqH5oMMUrINQ/h947KWmd4oH7QvqqUALJbz77MXoad+1yUISr p8lMuLkb0shQrfp5ygyk1fPv9+ZZ+QNVdydpXPokGJBrR9R4y29eSOB2DHkphjcll/dQ foacjvYaSV0cjtB/bK7RKuJlMGkTtpHBn5ZEBiTA3zP5JxOY4CWUyJD/lCiP4Izj7JXj zicA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=u6lCMOJBxFXFYmVcVNt/zc0jKT+n1PEiVlC/ff/AZGk=; b=MHZqKzPLs6pe5ficVjGtc6vXTZcAQY3pte/hVrbi8bI9D3Q2uevAdM+jfxLiA1ZrDL +EXTeKcLVX7M2sOCiDnyZoKXzdxipOSo6ZB9e0STfmkTDcXtvsAmidcaZY5X5L7v93cY m7qi97HnSImXBFIp9SIm14ivggU0ZOGrtPeC897txCkg45umpHatopZfqk6ytBR7HKsi /aJUoJrAWKPivoTZsAxlF4JJtqP6pv/a4ChDWuozMcrSramIYZOTiVZe7/1pcX4OJCZh YqLcURZoZ1W8Y3B9xNLC+U9phmogdK88ghpMGW74zeqsmSqsYAhG8V8iWFsQEQ520KL/ Tm4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gA661EJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170906794900b0072b3df402efsi13902642ejo.124.2022.07.26.13.42.32; Tue, 26 Jul 2022 13:42:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gA661EJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239953AbiGZUgQ (ORCPT + 99 others); Tue, 26 Jul 2022 16:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239950AbiGZUgN (ORCPT ); Tue, 26 Jul 2022 16:36:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7F02E5FF8 for ; Tue, 26 Jul 2022 13:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658867771; 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: in-reply-to:in-reply-to:references:references; bh=u6lCMOJBxFXFYmVcVNt/zc0jKT+n1PEiVlC/ff/AZGk=; b=gA661EJuxGw6qRJUrUxiL7QpmAKRhw4vHOHlcEjn7fp2g/FtkUXCsZUN4uzr9bpeKUyzU2 l05fcIA5KgPBhLuB72IHiEifpiSw7tj0o5DznjG7vIutZGlsA40Deu9FO/xVPpBpT7KJtX iH5RDUFGcKznJZa3q1iXgU0LQzePvbw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-483-HQZTz32qPjKAgOrSi5m_vw-1; Tue, 26 Jul 2022 16:36:09 -0400 X-MC-Unique: HQZTz32qPjKAgOrSi5m_vw-1 Received: by mail-wr1-f71.google.com with SMTP id o8-20020adfa108000000b0021e903fb612so1085535wro.0 for ; Tue, 26 Jul 2022 13:36:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=u6lCMOJBxFXFYmVcVNt/zc0jKT+n1PEiVlC/ff/AZGk=; b=XOZV/lhW8crjIi2G//J0V6nl8I3PrGQKCITs4QcF/gz/h9SIKkgL3MuwrC3YHly+VN 0rwCzppXYHceR09aiwp+9jtEkfO2F/3s6nmib0UvhM4hpEh4ZjTf7hcY1px/ZeGsjC+C Dge9+pMj8EWEYXtKLrYMFjvvtiNMI1ybBwBAgXV4F+1g0hFobF2wUAhhZJ5+uuKGWwpR SWgoIkNG6kWX/HJoCf1M1RN5SGRI6m5n9bFIXBzgGWh8EIBTvoVTRXRA7wDyYXfjI/H5 4KmynJm74mIWV+RfkpVHKeWuph5hPURAV1EJIwDupjkMnJm90HSYRyiHHACGlnZc7EQO xR2g== X-Gm-Message-State: AJIora/nRcr7zBT0ukHy1KWR1iszqQzSHD+V9zql3WVCGOEBIL2uKX5/ v3hTSyL3dDSVax35rQ+pCYXAamQfNX5NEBC4SDglwXlPISfGzqcBN4gcb7Qw04WxSpZkzxKRy/F MDJsrjX6BviM78OUB4T6ulTft X-Received: by 2002:a5d:6b89:0:b0:21e:b591:2b80 with SMTP id n9-20020a5d6b89000000b0021eb5912b80mr2143817wrx.33.1658867768661; Tue, 26 Jul 2022 13:36:08 -0700 (PDT) X-Received: by 2002:a5d:6b89:0:b0:21e:b591:2b80 with SMTP id n9-20020a5d6b89000000b0021eb5912b80mr2143804wrx.33.1658867768400; Tue, 26 Jul 2022 13:36:08 -0700 (PDT) Received: from vschneid.remote.csb ([185.11.37.247]) by smtp.gmail.com with ESMTPSA id z11-20020a05600c0a0b00b003a17ab4e7c8sm27632453wmp.39.2022.07.26.13.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 13:36:07 -0700 (PDT) From: Valentin Schneider To: Tejun Heo Cc: Lai Jiangshan , LKML , Peter Zijlstra , Frederic Weisbecker , Juri Lelli , Phil Auld , Marcelo Tosatti Subject: Re: [RFC PATCH] workqueue: Unbind workers before sending them to exit() In-Reply-To: References: <20220719165743.3409313-1-vschneid@redhat.com> Date: Tue, 26 Jul 2022 21:36:06 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/07/22 07:30, Tejun Heo wrote: > Hello, > > On Mon, Jul 25, 2022 at 11:21:37AM +0100, Valentin Schneider wrote: >> Hm so my choice of words in the changelog wasn't great - "initial setup" >> can be kernel init, but *also* setup of whatever workload is being deployed >> onto the system. >> >> So you can be having "normal" background activity (I've seen some IRQs end >> up with schedule_work() on isolated CPUs, they're not moved away at boot >> time but rather shortly before launching the latency-sensitive app), some >> preliminary stats collection / setup to make sure the CPU will be quiet >> (e.g. refresh_vm_stats()), and *then* the application starts with >> fresh-but-no-longer-required extra pcpu kworkers assigned to its CPU. > > Ah, I see. I guess we'll need to figure out how to unbind the workers then. > I've been playing with different ways to unbind & wake the workers in a sleepable context, but so far I haven't been happy with any of my experiments. What hasn't changed much between my attempts is transferring to-be-destroyed kworkers from their pool->idle_list to a reaper_list which is walked by *something* that does unbind+wakeup. AFAIA as long as the kworker is off the pool->idle_list we can play with it (i.e. unbind+wake) off the pool->lock. It's the *something* that's annoying to get right, I don't want it to be overly complicated given most users are probably not impacted by what I'm trying to fix, but I'm getting the feeling it should still be a per-pool kthread. I toyed with a single reaper kthread but a central synchronization for all the pools feels like a stupid overhead. If any of that sounds ludicrous please shout, otherwise I'm going to keep tinkering :) > Thanks. > > -- > tejun