Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2139948rbb; Tue, 27 Feb 2024 11:51:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNdRoewJ1MNyFvvkb6S//foVVXpPLVNMh86cPAkOL2UsRCRZ7lKJFWOJy7OaPiswwTXZOqg2QtUAGFBHIG1D0W5AlNaZv0tl+T8fQSyQ== X-Google-Smtp-Source: AGHT+IEizEeWDyw7jJH0Z1ke8YeAjeTn9Se3L3NKuvquRpIXZ28+0/jLhmY+Q141ghYqCc9545Y5 X-Received: by 2002:a17:902:8c97:b0:1db:faa6:d4b3 with SMTP id t23-20020a1709028c9700b001dbfaa6d4b3mr11847926plo.11.1709063486135; Tue, 27 Feb 2024 11:51:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709063486; cv=pass; d=google.com; s=arc-20160816; b=vuxJxQdn1/9FWWBEGC5dBYrnbACmXHCEyrysDSMA2At4pHh0VI/3JannfSnQ2JWzMY NfUHc3n43SjVZbOyqJsr05LxPcQJiPr+ylBb+J12009VnCE7Nv6ZLiFu7YTvln8f4Z+c d4YmNvLv5Eb9wThCOl4Az6Z8/Pa+7077/7uCkiTHa18L121krqy/ckZM9VTNtsU9ahFG L2zj4RGvuS+LPGKLWmprKR7vALC5eKGxOL3ic6s6vjHxh38oKENHUQTu02JENYDLbuoc sPnum3H6K4vQM9u6yWP9JOY9vs2EGeACT0qmEfgf6Xyaybfy74OEEyjQ4qrqxWp4zNIH xSaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=R+XYa+6xdty24fg8M4aMK8wsLqrMuV3Nkbfx/C4KTQw=; fh=M7TsrF9wjs6UCLzjZD55FKQvtis7eA2SFUDfL/yoAi8=; b=MC0GMUQW1az/X1TP1xwtiG7oAXIREGAgv9041krNJKkhwSYew5QmPWBqHR9bbA38eg zYdBps9LkUwIx2FJKZdt847oBqaNkocQLixXCVld/+jPNZzLaXvowCFQd2XC3jkgDenC MzaJ0Gm/RZyxTRjBAJiQIDLd8UwfVkoCszS1mqayQWZiRAi7zlnovQyVNJAUylcl7JQU b+/x9BMHcn7BTm9c1ZMkfjSln2HRWvqVS6gUV0NVIQJRWqgD9Lyd/MonFa2TvzyOgtfL UB/OiOlwtRBAGbqOWXMWgHvVQoaUFluOlLbMsyrcF7ATNxFtYatAtNvcRFZBodtwno0W bt1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="WBd/DPGl"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n3-20020a170902f60300b001db719a8412si1831199plg.311.2024.02.27.11.51.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="WBd/DPGl"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C68FDB2AFDC for ; Tue, 27 Feb 2024 19:01:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1647C50277; Tue, 27 Feb 2024 19:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WBd/DPGl" 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 E14C21E894 for ; Tue, 27 Feb 2024 19:01:28 +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=1709060490; cv=none; b=Dckfii+U8TRaOEkjgJeP0I1ZjRWN5g8N4NB3VB4KDLuFXP8TPUU8LyolEe7ywZ5/B3PSG+ZUl4OG6QU5TzqwYiPFyHsO0bBGOODTkAnO5cl3WgUV/ixXCixW+mujPP5jg1CbWH5XSqQlRts2UX34mn+pgZ5ilZ6z+98bJUQKfBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060490; c=relaxed/simple; bh=SFqUZKS3btSbaCVDcjF20U6jeyelHzTX5jo8GjDl914=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l2MN24i61pm885kkX4g8364Od6uIJEeAlyX3oZK5OcFunpj5c8pPItXBkGAiyJd5pB/e2iZArtw6tHQfqpYJDHa7OXZVk8OJTs9PBpc7RVw7DfVRPPKQAjtSvOnybOtmRLwTfSoUtnpg8/XUMllGZOpJOOCCd3+QEw6N7Uv4PXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WBd/DPGl; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d93edfa76dso40357745ad.1 for ; Tue, 27 Feb 2024 11:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709060488; x=1709665288; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=R+XYa+6xdty24fg8M4aMK8wsLqrMuV3Nkbfx/C4KTQw=; b=WBd/DPGlm08/174v24c3yzS3yIGLagt1XLAkL2xKYqkZmI52xfHnRMGno2dKTyS8f1 zisGQ7rB7wmvlU10cmXwiQ8EnLyAhAdOA5bfDt8EdhwNA7zLLyj16XxrcLNXgv2aBiEA QC5i6HETWl03q8U9SIXEcHGJ31Hgabtx0fozbnJ5mch+wBdy2jdnnBqRW1qjYzGK1tF2 TxRFtkSefGgjjr/USRjSYv05bU+jyhsJHdQQLsXXQXaiPz9qo7fX8OVAq7pjLxLve1zI DH088HGhE0YvfHQG6+Zo8YPajsQCGBVGZ/UeUrq8FeblNBVNU2OvHTWWoTwaPgYoSMGj 6Tow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060488; x=1709665288; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R+XYa+6xdty24fg8M4aMK8wsLqrMuV3Nkbfx/C4KTQw=; b=FXEdb2pC1vfkDpxY45CkwT4Ymm+K4ypnt3QQorw5SLn32UhhYRzcNHyKcY9Khjl7Vd O3dZ2ryPd1/rbQ26GK+g5XBW0trDzSQ2HoUtoylqocll4+iwWdBA5/DQq1LWYVLD5zXH PT82Tadc0b+rX4c7Zh9WVe9wWsImKnGbeUAK5M0qiU2B8fIdOxwtd/7elp3mgndJbBf9 O0YhViQA9Rg4duoTkDWl0/mYdlDODHo+CTTpljjTj9/Rohds5yjhf+iRSh8ijgZN/+lS IAPlOv9hYd/PuuUy5LRBLfbEhqQ9YIC45Fw6mdvLM+4ZEUUcE5+89q6NV95okWogSUsR zWbg== X-Forwarded-Encrypted: i=1; AJvYcCWdq/mi3dUQMWN1kBDakBATcRJXajyB6VtpepDjulihX8i7WQoPjQrMZpp9hoy0GP4C0mZxyMDOOvdgNwb5rV0WquU3u+o/78RDcEzx X-Gm-Message-State: AOJu0YxXwOsCFrkpijOyEfbQ5VIPiflFjSsNAF0TBOIUNOFtSMRZW0J2 sWITxVWGobKR5vbQN+tU//smFikxrqV/Zb2t8xvnkQQynyrU4GB7Bs3RhbM99bM= X-Received: by 2002:a17:902:fc87:b0:1db:4941:f703 with SMTP id mf7-20020a170902fc8700b001db4941f703mr12832574plb.15.1709060488029; Tue, 27 Feb 2024 11:01:28 -0800 (PST) Received: from localhost (dhcp-141-239-158-86.hawaiiantel.net. [141.239.158.86]) by smtp.gmail.com with ESMTPSA id h1-20020a170902b94100b001dcc3b0b612sm421448pls.287.2024.02.27.11.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:01:27 -0800 (PST) Sender: Tejun Heo Date: Tue, 27 Feb 2024 09:01:26 -1000 From: Tejun Heo To: Allen Pais Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] workqueue: Introduce from_wq() helper for cleaner callback declarations Message-ID: References: <20240227185628.5336-1-apais@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240227185628.5336-1-apais@linux.microsoft.com> On Tue, Feb 27, 2024 at 06:56:28PM +0000, Allen Pais wrote: > To streamline the transition from tasklets to worqueues, a new helper > function, from_wq(), is introduced. This helper, inspired by existing > from_() patterns, utilizes container_of() and eliminates the redundancy > of declaring variable types, leading to more concise and readable code. > > The modified code snippet demonstrates the enhanced clarity achieved > with from_wq(): > > void callback(struct work_struct *w) > { > - struct some_data_structure *local = container_of(w, > struct some_data_structure, > work); > + struct some_data_structure *local = from_wq(local, w, work); I'm not necessarily against it but it's a bit meh in terms of how much it saves. Also, can you please name it from_work()? Thanks. -- tejun