Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp254545pxb; Mon, 13 Sep 2021 18:29:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGOLg0jOG5lbkq+6tDau5bLYVHqB9p7ChprHMzFpUS4E4BHfRQbyUPTKeeMb2rVmlCFFAp X-Received: by 2002:aa7:c4ce:: with SMTP id p14mr9016180edr.129.1631582973404; Mon, 13 Sep 2021 18:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582973; cv=none; d=google.com; s=arc-20160816; b=BWvmjnECEJj3qxSHYeklrjSTlvP9JQibv57K7BS9wpAQQQCa9FBSLJzva7k+Lc68If lZe0ArCplWoL+hZUfgNXBF8kFlhdGCUHu+VwUjPkz0cUrygTFnX3BYNv/F/tqcU3+tUo Q3VYWdOWp0ZmEfpYGnUFg27+z0z095hrHQXgHK71NJYWmgvSuZ7TUrLImnPuYpYMdt74 N4sp4gOYAhlz6oU6XGzxy12WKp2Sq8v+tnvolI4nDu9XI6RZoEY4QBtwrmRP7qTljnPN COHfDsjHcsSLtjsJmlKyDDkr81UvKuheKUBnhQfiC60vxOtCGGGhUlUbBYx1QDsr/CAH c+fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:dkim-signature:dkim-signature; bh=/fJh0QfLu557SRIcbnLQw5jXDd2d5nR20JToY2iryFI=; b=YBPmhMY53jN78iiNcqu15KCgVTuqCjO2LiJqc8h63bRvdohXmdcyfdMTBYR7LaqAQd 2faPsbzsQVa+E9fxgW6jCw1NCu7paOJLZwI31HRVAiB0tqow5oyCidExW3Xurhw6ZTN8 bX102mfhkhsVtrXN9BPeoZXdvKGsWZfzwPP1uHQfLpscn1Vz0PmearaHQeR1lDpYYt5k XivAaPr25SjvPtD62SXf9KA2YdVGxtplMnY7ikIHbkF8We+VejkW0zxanEpEPH61nghY zFLWmi4FgBRWC6Id0D0cfjYRI54YiIH40NpV0E47zzDoX09nd7g+A0KfA0itzVWEv21j IiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="HxscG/LD"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m23si8565801edp.258.2021.09.13.18.29.10; Mon, 13 Sep 2021 18:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="HxscG/LD"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238749AbhINA3u (ORCPT + 99 others); Mon, 13 Sep 2021 20:29:50 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55148 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238544AbhINA3r (ORCPT ); Mon, 13 Sep 2021 20:29:47 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EB9EB200AC; Tue, 14 Sep 2021 00:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1631579309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/fJh0QfLu557SRIcbnLQw5jXDd2d5nR20JToY2iryFI=; b=HxscG/LDiGhsXGcbasBy/GQpdvuvcezFHx0oNgiHTzBfG6jLNj7at1rWx8uH73RB9dCBEK 43zz46aMTEEwRh8Kab1HMrXpHEHa8osZ6ZQ61ivRCI80gCkcehQ/wgKC04GE2CRXQEzw46 /6h+o/IWXCBi0R7pu+/Q8WQGi/3R1gU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1631579309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/fJh0QfLu557SRIcbnLQw5jXDd2d5nR20JToY2iryFI=; b=zy9E9ltAIbtS5E4r1Cp18Z6g2l7UU2NIsT6UJfPtYAJjWhnxeEspX3gl509vflmF/5AQeU SGQVgd8837Ms+xDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 91DDF13ADE; Tue, 14 Sep 2021 00:28:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EE9HFKrsP2FQawAAMHmgww (envelope-from ); Tue, 14 Sep 2021 00:28:26 +0000 From: NeilBrown To: Andrew Morton , Theodore Ts'o , Andreas Dilger , "Darrick J. Wong" , Matthew Wilcox , Mel Gorman Date: Tue, 14 Sep 2021 10:13:04 +1000 Subject: [PATCH 5/6] XFS: remove congestion_wait() loop from kmem_alloc() Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Message-ID: <163157838439.13293.5032214643474179966.stgit@noble.brown> In-Reply-To: <163157808321.13293.486682642188075090.stgit@noble.brown> References: <163157808321.13293.486682642188075090.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Documentation commment in gfp.h discourages indefinite retry loops on ENOMEM and says of __GFP_NOFAIL that it is definitely preferable to use the flag rather than opencode endless loop around allocator. So remove the loop, instead specifying __GFP_NOFAIL if KM_MAYFAIL was not given. Signed-off-by: NeilBrown --- fs/xfs/kmem.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c index 6f49bf39183c..f545f3633f88 100644 --- a/fs/xfs/kmem.c +++ b/fs/xfs/kmem.c @@ -13,19 +13,11 @@ kmem_alloc(size_t size, xfs_km_flags_t flags) { int retries = 0; gfp_t lflags = kmem_flags_convert(flags); - void *ptr; trace_kmem_alloc(size, flags, _RET_IP_); - do { - ptr = kmalloc(size, lflags); - if (ptr || (flags & KM_MAYFAIL)) - return ptr; - if (!(++retries % 100)) - xfs_err(NULL, - "%s(%u) possible memory allocation deadlock size %u in %s (mode:0x%x)", - current->comm, current->pid, - (unsigned int)size, __func__, lflags); - congestion_wait(BLK_RW_ASYNC, HZ/50); - } while (1); + if (!(flags & KM_MAYFAIL)) + lflags |= __GFP_NOFAIL; + + return kmalloc(size, lflags); }