From patchwork Mon Mar 6 16:32:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 64935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1942922wrd; Mon, 6 Mar 2023 08:38:59 -0800 (PST) X-Google-Smtp-Source: AK7set9yUDH0zpIw9hKOaaoJObLlzdUqeLDKKirRJHR/cRahtH5UUNXn5HdxIpiFoin0FRAWB+BH X-Received: by 2002:a17:90b:33d1:b0:238:13cb:7d4d with SMTP id lk17-20020a17090b33d100b0023813cb7d4dmr11898579pjb.16.1678120739500; Mon, 06 Mar 2023 08:38:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678120739; cv=none; d=google.com; s=arc-20160816; b=VWmeDdthCB8JdrIu5N/H4OsDV1ox7TxrrVsuamHzjtwWwkM1a6zuX32U6szDD227d2 YrBWhEkHgmOA8TKCm4VBsOT1HvhzjsXFnio+7zFZKjdhmjc6ftGMVUp3h5fKHdHdaLZi +9Ex3dr7lE9ndsjPGDZuSe1pyGAj/WqVSS9LBX1sYQTM7ScqxpVMn8QnMYgKtOdtpoTc skHOW6jcKxdkw/61hq5b3m/R7DicUTvfHjekMVMkgnnJdsPE4wMr8Uj0OAM+KZmPEkDn nY6BDhuDXK+Pjk6YdFddQwec6xMWfJRv6obzP21cvxGyKdG2PETrp/3Y666C5+xoyQPk gvXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=8GiGVgb2QDvbeF7O2lnMhzfvjppKNp9pNdT+ncJDmK8=; b=CrCIis8CrqZ5qmm0uWxZ+7hWPj2Ni6/kul9hxNs7m9jn/d28bea70yokIHjVtvkHE3 bUANGoOT7csXIsygDS2pt86LlzbVYHs0EhaRD+vwQ6+omKaBTlu7aFhCYiYIgtrTr3by d4Ua+Q6vSsLiLcEaj9k6xzjRJBPoCqoWVQfoJ7YgHERaJaWzz6GOjy2H6+Y6XWcbhzxw as75IMxnDqjWBFvyJnFvkPNsEptA5zIr/GxEi6YleVXm1cim7qiPNFhQ+6HVmWpRqECm AkCzIsVv69FJfSU4zhf8OXqVUmH/93lbLeqsanF0VW17wUf5uZVr/aXgGqbBKvrbKCC9 fCag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="m/RTaqTM"; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a2-20020a17090a8c0200b00219f65e19fcsi12556966pjo.170.2023.03.06.08.38.45; Mon, 06 Mar 2023 08:38:59 -0800 (PST) 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=@intel.com header.s=Intel header.b="m/RTaqTM"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjCFQgd (ORCPT + 99 others); Mon, 6 Mar 2023 11:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbjCFQfr (ORCPT ); Mon, 6 Mar 2023 11:35:47 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1E4638662; Mon, 6 Mar 2023 08:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678120514; x=1709656514; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0eAGjVOQ2rbaK9zJyF59qMjxM1fjU52p32WNDpV9uis=; b=m/RTaqTMyXDnIrWFH58wZy5g7vadgMyPgDutC8vUY6Q/kZvF6xz6tzxg 9Yu43xORSem409piPbNzl9yJYO5BkRcWIv3ZzGgfauuboGDM3X10842Q+ hlFty/C5yMgRYXvK7dZodDMqZbU9u8DJ8Cka98FR1lBTRd0LxpQ61jdgD RfR8t8ODqIsy1+GYBC372CKwOweF6Yd/RnKjBhVnLxMaEAati35WzFf9G 6YpVcGG0FsyB6vD4Bjwlcr5ceASMSCRHnHs8UAHajLOz6xULkQ1A8l5c+ dfFFB77AkAMxSTVSYTr4PSfTVD7Ds74CIiTEB27yLICsYRsKng74N7Ljt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="315998652" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="315998652" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 08:32:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745132872" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745132872" Received: from lab-ah.igk.intel.com ([10.102.42.211]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 08:32:32 -0800 From: Andrzej Hajda Date: Mon, 06 Mar 2023 17:32:00 +0100 Subject: [PATCH v4 04/10] lib/ref_tracker: remove warnings in case of allocation failure MIME-Version: 1.0 Message-Id: <20230224-track_gt-v4-4-464e8ab4c9ab@intel.com> References: <20230224-track_gt-v4-0-464e8ab4c9ab@intel.com> In-Reply-To: <20230224-track_gt-v4-0-464e8ab4c9ab@intel.com> To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Chris Wilson , netdev@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Dmitry Vyukov , Andrzej Hajda , Chris Wilson X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759637132830087239?= X-GMAIL-MSGID: =?utf-8?q?1759637132830087239?= Library can handle allocation failures. To avoid allocation warnings __GFP_NOWARN has been added everywhere. Moreover GFP_ATOMIC has been replaced with GFP_NOWAIT in case of stack allocation on tracker free call. Signed-off-by: Andrzej Hajda Reviewed-by: Andi Shyti --- lib/ref_tracker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ref_tracker.c b/lib/ref_tracker.c index 2ef4596b6b36f5..cae4498fcfd701 100644 --- a/lib/ref_tracker.c +++ b/lib/ref_tracker.c @@ -189,7 +189,7 @@ int ref_tracker_alloc(struct ref_tracker_dir *dir, unsigned long entries[REF_TRACKER_STACK_ENTRIES]; struct ref_tracker *tracker; unsigned int nr_entries; - gfp_t gfp_mask = gfp; + gfp_t gfp_mask = gfp | __GFP_NOWARN; unsigned long flags; WARN_ON_ONCE(dir->dead); @@ -237,7 +237,8 @@ int ref_tracker_free(struct ref_tracker_dir *dir, return -EEXIST; } nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 1); - stack_handle = stack_depot_save(entries, nr_entries, GFP_ATOMIC); + stack_handle = stack_depot_save(entries, nr_entries, + GFP_NOWAIT | __GFP_NOWARN); spin_lock_irqsave(&dir->lock, flags); if (tracker->dead) {