From patchwork Tue Feb 27 16:48:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 21034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2822282dyb; Tue, 27 Feb 2024 08:49:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcUfW/Q6eaCmxLWenO0goUNKbuXyCK29lerxUx7+0yPMl69V7/cDnj/Vf2fldQ1obii+F11XRsHRbLA89FnrlO3rK02Q== X-Google-Smtp-Source: AGHT+IF+tLEKcVbAXZsIXuWtHi9HtyRc7NUiOlA6/xglj4th+u/lvHNPG7/NWiF69KUC2piBDNTU X-Received: by 2002:aa7:dd12:0:b0:565:7c9e:97e6 with SMTP id i18-20020aa7dd12000000b005657c9e97e6mr6338151edv.11.1709052564761; Tue, 27 Feb 2024 08:49:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709052564; cv=pass; d=google.com; s=arc-20160816; b=rXLr8z8F4vHXSfH+OoZiWfun1YbfWIrj7QdhVMxU2YMqb2gtA55fVgvU693pywDicC YtaAyeOb9tPZZoGffStb051C0K+bdkHgqKLxF6eBBOF/p5n7d7E4E8XagsoOPHZ9pxk4 STLLuCvXAj2Z2149f6bBDM16B2Va0ReFAlD8A54w4OAmtUNbrJTDPDh+Ruaw11b0ihAF DEBqObeehFRVt0NI38SoXB3zXW98B+5h4+ua4ADoO4+rwJAFxD/b1dKGJhq4fTQ/hsCq mELPMTGQOVw4BBWtxKYU9zq64+Tta31NALvzk+yNcO3P0pNODItmqzOFcDPJf5FTqEeN 98EA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:date:cc:to :from:subject:dkim-signature; bh=WIiS/t+fS3T73wRU+1sDG/kUyC87RhIB20xz7id1B2k=; fh=aHzArWb8dHUYJNewtjN74//flmRNijOcrZtWe5Pz3m0=; b=cEVrwZj8nokVgKWa3kFRocp8TQTaSYnvUqThOxJ3GwhMxKttJrbvx8NFa1o9XeHfuK QNfU3ThhOoKo3xUdUNiC8lDjQYR+A4MKyvyGRrqMsL1xsk0nlJ1IbsLwQokWnSb63A6l Vk05agd4IbD4/NZfciSoayrPP8BSgQ0uWFnEsfZ12rG9Smpjfkd6D8HYe+PEZf5UyxkF pthHEHUMkQzKHHuPlPy7hZX4+NgFyrZdNtQdjppryq8ZF+tqbeEXrQaxL7ht7IDCLcAM oGWJl5B0o3BgrSMJcyBx60CnwkQiNnNgHc+jUQPpVVi8l1iMq2sQ98bBMA1YaPnGcqt0 TWgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VAt5aIZU; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-83647-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83647-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r20-20020aa7cb94000000b00565765b4bb8si848646edt.563.2024.02.27.08.49.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 08:49:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83647-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VAt5aIZU; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-83647-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83647-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 61FCC1F26954 for ; Tue, 27 Feb 2024 16:49:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0492F47F58; Tue, 27 Feb 2024 16:48:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VAt5aIZU" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C1202C69D; Tue, 27 Feb 2024 16:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052531; cv=none; b=NxexG2HgZKgTvYhLIy/S59IppVrzfXvRKni1mUO0ZUP/l/wzAqmrrWob4/fPuF7exE9aVnqf8YI+HeI6fUYoRhwMS+oLprdgukMYrpZRlOan7ZqGl8o/nezOJsPSj9JPtjC9P/u6JJIRQojabLII30C2zGMhivuvRCaXKAtgve8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052531; c=relaxed/simple; bh=GtJSUs8Zd08aEwUhpwlgPs5kZeQj2tOYnSlh4NGkwac=; h=Subject:From:To:Cc:Date:Message-ID:MIME-Version:Content-Type; b=ede/qpHqHpIVM6a9cJEyZKiFfep59qqU5GaXRulntV5/gtBrDJJJP7b74DeMQ+5dSPx6H5S5+8HDcaghVL5/Vo7HPkhbRzCERJtUV0NZkhK9Hr6GRt6OxKSADiw2TfZeOFbeHxawVa6VxWI1gvJ0HIjXcr6aP8+wMZkreEGVbMY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VAt5aIZU; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709052529; x=1740588529; h=subject:from:to:cc:date:message-id:mime-version: content-transfer-encoding; bh=GtJSUs8Zd08aEwUhpwlgPs5kZeQj2tOYnSlh4NGkwac=; b=VAt5aIZUs9Lg5f8h3pCUYEwZVJUn9RXNEvg9Rf73c9swibJLXIa7bLkH 8UIBmeoYeVX6asbavo9nqhptmEqrZ8WYGFyo+VCymCsfWGI16tEpSzHpF 8Ibnj9noy3OQ88c8h1CoiGJDtwtg+IdoF4n3K8ljlK78qlAPm2sPVH+GI MbjKipZ6flBxn/gPbCJcsBHWLuRRM7A0wKDnzhIG3D3HoBJZqJ9VwuzJq mWaygvF9/XWNpigF0GPfqgDty3cgdzXGCGjGx2glQ3Zwz+GnG5G+Jx2QE NlKN3fyENeiQatlTB/cM1n1V2SHs5xscGCHxCQLsp+mv5R6vjRucsriF9 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14043579" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="14043579" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 08:48:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="44614001" Received: from sshaik-mobl1.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.88.67]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 08:48:49 -0800 Subject: [PATCH 0/2] cleanup: A couple extensions for conditional resource management From: Dan Williams To: torvalds@linux-foundation.org, peterz@infradead.org, gregkh@linuxfoundation.org Cc: Ira Weiny , Dave Jiang , Jonathan Cameron , "Fabio M. De Francesco" , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org Date: Tue, 27 Feb 2024 08:48:47 -0800 Message-ID: <170905252721.2268463.6714121678946763402.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792071502103255705 X-GMAIL-MSGID: 1792071502103255705 Hi Peter, Linus, Greg, The cond_guard() patch has gone through several rounds of review and is looking good to me, but is missing feedback from one of you that have been grappling with a cross-kernel view of what these new facilities should look like. Separately I have been running into trouble trying to fit no_free_ptr() into some cleanup patches and thought of another way to build on the conditional syntax originated in scoped_cond_guard(). More specifically, scoped_cond_guard() introduced the concept of passing a statement to the macro to handle the failure case. cond_guard() extends that to be used within an existing scope to automatically release a conditionally acquired lock rather than defining a new scope. The cond_no_free_ptr() helper takes that concept for ending the cleanup scope for objects when responsibility for freeing them has been transferred to a 3rd object or subsystem. --- Dan Williams (1): cleanup: Introduce cond_no_free_ptr() Fabio M. De Francesco (1): cleanup: Add cond_guard() to conditional guards include/linux/cleanup.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) base-commit: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478