Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp973079pxt; Fri, 6 Aug 2021 19:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0+ePPmEOFRHwd5G+Bl+m/8r2omZ138/6q/nX71gL8LeaIXFKhuoFuwxG9/o3/H3H4LHBt X-Received: by 2002:a6b:f416:: with SMTP id i22mr177393iog.162.1628305089955; Fri, 06 Aug 2021 19:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628305089; cv=none; d=google.com; s=arc-20160816; b=1JnHDjGIml50HMc7moy3QXzZxnyh8yc7V5sIXYdPXJWIYmQuAngWjOakn6FseN3wiM 2RgVpZp4JbjlfUuOQAMYPowBHMRmJ4Z5DunZyElmVTE8DEs5qwM4x17GytwvgDOWzutm 6UU2bBG8FQl4KSbCiEWsnn0drFi2w5HCbDacbmeg8LH6SouErXQvscTjMQWs5jGF4QUa BXDYN6mblKH0zes8d/YM+ZotUNEqzdkXE+IXAJkEmQIG+/6mhGh9qDBCWcaTjbhUIPkc iHhZHcBWqKUr4SVCoJuCGgDYVsvCHJ+HeIInMfB+9v6u64wFOvoz6mtiyGpAxiy3kQqS tPig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=SZA1Bl+ATZQNgry7pTGV5hph7QyuNHAexwAUe0LexzI=; b=Zm7TgqLIqwUQ+tUgXH2Lk50YWwFvH1Z+iOf8FR5tHyQqfOyWqg9hZjkmEg7b7WDkPN nlZ48NUcfDBGQXV5N564s7DUK2rF+AV+cbevilMgIV/dhGt75id5pGpGvdiCwQ3Sxjo7 smdg9dvqRAITyj2Sp323yYXwhE7VT/7Sj4kkMVeL/4urpOnqwuE//sWkydnUIVRcsfQU ke21EorVhHXTDsDzSxugobmUUtBAQGySwXe1B/aJAjKQhl0DHdV2m3IDUAVOvB6gH2RI TIarleOHdO2slE2uJCy/5JaafWLKP2qpVE/dmwOfdYIAG2/FrzuV1ztt44mFeyRlDRIY s27w== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si12432702ilv.151.2021.08.06.19.57.56; Fri, 06 Aug 2021 19:58:09 -0700 (PDT) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230231AbhHGC4m (ORCPT + 99 others); Fri, 6 Aug 2021 22:56:42 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:41532 "EHLO mail-lf1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbhHGC4m (ORCPT ); Fri, 6 Aug 2021 22:56:42 -0400 Received: by mail-lf1-f53.google.com with SMTP id y34so21694844lfa.8; Fri, 06 Aug 2021 19:56:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SZA1Bl+ATZQNgry7pTGV5hph7QyuNHAexwAUe0LexzI=; b=MrBd715sDF9tIz5p1LZDDzMRxAgEiDGtwFI5jigm2+2u4QnCyglvVMzAcg2I+nIKM5 P63mU04ldG4g7n3NBlIWe/H2E2MhylTczHGk+fvbiBVKDP+7Aqz3eceoI4N7N0bpbQEO 8f5A1F2JK89iOjwz6fDJiVYFJcXNaPAO+T8F5aK3MCh8RwsSLA4zwwLhCam/FDe288Bl +BroqvPj7EffdonQdx4LR3IkYW51JCJcnh8cbadWXCOg/fGsHQtLfMMjRypogktni9W4 F8GfUsE7Y9CvQIdhpZpOckGG0xkqei+dRFZic69sGzSv6AoXMkP8Xi89NlCA9AsVz152 DbGQ== X-Gm-Message-State: AOAM532AsHrxHDigrBdThl5pFkWtEIpJtTP0GxgA+9a19b9uutngejM3 AfQxyMKgD7+OBpi4jU2OTXT6xtsdsRTQipz3cBs= X-Received: by 2002:a05:6512:3456:: with SMTP id j22mr9411396lfr.635.1628304984230; Fri, 06 Aug 2021 19:56:24 -0700 (PDT) MIME-Version: 1.0 References: <2b55c73f1c1738361d80349f1c67e5fe9cce7174.1627657061.git.rickyman7@gmail.com> In-Reply-To: <2b55c73f1c1738361d80349f1c67e5fe9cce7174.1627657061.git.rickyman7@gmail.com> From: Namhyung Kim Date: Fri, 6 Aug 2021 19:56:12 -0700 Message-ID: Subject: Re: [RFC PATCH v2 04/10] perf workqueue: add threadpool execute and wait functions To: Riccardo Mancini Cc: Arnaldo Carvalho de Melo , Ian Rogers , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel , linux-perf-users , Alexey Bayduraev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021 at 8:34 AM Riccardo Mancini wrote: > > This patch adds: > - threadpool__execute: assigns a task to the threads to execute > asynchronously. > - threadpool__wait: waits for the task to complete on all threads. > Furthermore, testing for these new functions is added. > > This patch completes the threadpool. > > Signed-off-by: Riccardo Mancini > --- [SNIP] > +/** > + * threadpool__wake_thread - send wake msg to @thread > + * > + * This function does not wait for the thread to actually wake > + * NB: call only from main thread! > + */ > +static int threadpool__wake_thread(struct threadpool_entry *thread) Same here. You can pass pool and idx instead. Thanks, Namhyung > +{ > + int res; > + enum threadpool_msg msg = THREADPOOL_MSG__WAKE; > + > + res = writen(thread->pipes.cmd[1], &msg, sizeof(msg)); > + if (res < 0) { > + pr_debug2("threadpool: error sending wake msg: %s\n", strerror(errno)); > + return -THREADPOOL_ERROR__WRITEPIPE; > + } > + > + pr_debug2("threadpool: sent wake msg %s to tid=%d\n", > + threadpool_msg_tags[msg], thread->tid); > + return 0; > +} > +