Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1018267rdb; Fri, 16 Feb 2024 02:52:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6YcQIrVQVe2wzYYa0GSfXj3Tvuzsg1aqHW4V47alHNEltS75Y4azu0Nw72lBORjKMuvYv9Lh5lxXCNqgwRhm6hubxp6wBEMr2xwH4hQ== X-Google-Smtp-Source: AGHT+IFxhnGPolZfFNzcAZDxEyXUszhN+k4ilNBNL2EvtZpXWBWS8sDPuP7kK2rE8ihD2lTdRY1D X-Received: by 2002:a17:906:f9d0:b0:a38:20dc:9fb6 with SMTP id lj16-20020a170906f9d000b00a3820dc9fb6mr3002107ejb.25.1708080729739; Fri, 16 Feb 2024 02:52:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708080729; cv=pass; d=google.com; s=arc-20160816; b=wjGfKDYJCe7PbJ7I9g51uZaEKkRzj2yEQ+sOoq54MoAKtmFn0k64zc8WEWDVU15FKc Nij4cUAPxZAgUKTmbpVC9rIazbyHsMMKp6Hp/X4CZHh8CuE3FBA2/7rnxRIEtI5/LvLo aaSVOMGFTzaPq8W6/GWJDsAvz5nl0GWl9KkH6mdcZXOnf0N3xPV7P4b5/BrU8l2Vp5zZ EICO5n8keN+LLz+aFWj3KTQzZvar+Cn+3Ar3X7F6DX0UH4r7qy+8f6L/b9Y6+S/ukvsI iwLrUqfhsmluY8l9BKOcBxjV6NxgZfu8N0yx+xEPWh975Fatq23lkw8do8E+2GCzoz4l 4Kxw== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HsVTTgzq2FGwwqEfKhKEJosPjOOrVrIv3jpbJnAF9cc=; fh=WKTfvpSi3ZwnDqR6ejHBMzFn8RNJOtd2PUzsNHEkYPw=; b=Nvp0v8lw6sPH+CIcvJeSv6rQac+ffErWMPLMDcWEQtxHhSnfDWOaNknl/W5Dm3b3/R hK/qs6LYWwBZFLZj/fE4F0zxlwUK5HuEXmJBZYbra0yfA8xZon0GgLp7Aya/TufXyTGz jZBtHaOYpS6J39f5xjRCnNt0YaeyQwXDEBxhqKba0I3ODa2NFICVkKKoUq68pD0RLVVw yfis2zdtV0fHb0X5SPzACnbXbuazF8B5a6ERYumBO4o2ftCS1rtJKXZf3FGkii0+kUig N7OaILo0q9/A0v/XLH8Iw5AgrEOGCPxyS/bl5n+umjkwbKH+4LEZPskeScs2jyyY+hnO I1fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-68471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68471-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h12-20020a17090634cc00b00a3d53b0bf43si1539546ejb.46.2024.02.16.02.52.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 02:52:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-68471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68471-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 702E31F23A13 for ; Fri, 16 Feb 2024 10:52:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA2855381B; Fri, 16 Feb 2024 10:52:03 +0000 (UTC) Received: from r3-20.sinamail.sina.com.cn (r3-20.sinamail.sina.com.cn [202.108.3.20]) (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 259AA1EA73 for ; Fri, 16 Feb 2024 10:51:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708080723; cv=none; b=udXs/T4tzRPCLLQdff25TjcyDEwcKJXp91Zl0rBPBpT14MWZ+uw53W5cv+ZExbWXmTQOC213vhxK3uu98I1iB0yS+rWNcbt+ME9IDnVH19RA6xHfJv6qacYkGBuKy4IXPh0eTd9WVKIWjIWuXx5y+POp2m2d6yq+qOC2Th6emf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708080723; c=relaxed/simple; bh=abbIf03lUcClSEJqyuzm6ITM51kb8SzCiL98v7qTETU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t/K70l58l/ENo1d1xpo5AoSe1VRU2wdq0MZcxZgNkjjO6wUJcwlw8uUtEUuxpPL3yLGD3etIiH9mBRj0OysYdrwPfHhzWCu2+JQwf187ir9pcUcEVUrW6JxDE+iqbMfo0Ax7z+pIPc21ICHnCsofC6dyK3piF8+qhzU5DV8xp7M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=202.108.3.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.59.61]) by sina.com (10.182.253.24) with ESMTP id 65CF3E4300004350; Fri, 16 Feb 2024 18:51:49 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 8475961048607 X-SMAIL-UIID: 47A789C0333140E1AF36F219A4107BDB-20240216-185149-1 From: Hillf Danton To: Takashi Iwai Cc: Sven van Ashbrook , Karthikeyan Ramasubramanian , LKML , Brian Geffon , linux-sound@vger.kernel.org, Kai Vehmanen Subject: Re: [PATCH v1] ALSA: memalloc: Fix indefinite hang in non-iommu case Date: Fri, 16 Feb 2024 18:51:35 +0800 Message-ID: <20240216105137.1242-1-hdanton@sina.com> In-Reply-To: <87plwwiz6z.wl-tiwai@suse.de> References: <20240214170720.v1.1.Ic3de2566a7fd3de8501b2f18afa9f94eadb2df0a@changeid> <20240215034528.240-1-hdanton@sina.com> <87h6iaf7di.wl-tiwai@suse.de> <875xypk6d6.wl-tiwai@suse.de> <20240216043426.1218-1-hdanton@sina.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 16 Feb 2024 09:35:32 +0100 Takashi Iwai wrote: > On Fri, 16 Feb 2024 05:34:24 +0100, Hillf Danton wrote: > > On Thu, 15 Feb 2024 18:03:01 +0100 Takashi Iwai wrote: > > > So it sounds like that we should go back for __GFP_NORETRY in general > > > for non-zero order allocations, not only the call you changed, as > > > __GFP_RETRY_MAYFAIL doesn't guarantee the stuck. > > > > > > How about the changes like below? > > > > > > +/* default GFP bits for our allocations */ > > > +static gfp_t default_gfp(size_t size) > > > +{ > > > + /* don't allocate intensively for high-order pages */ > > > + if (size > PAGE_SIZE) > > > + return GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY; > > > + else > > > + return GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL; > > > +} > > > > Looks like an overdose because both __GFP_NORETRY and __GFP_RETRY_MAYFAIL > > are checked in __alloc_pages_slowpath(). > > If the check there worked as expected, this shouldn't have been a > problem, no? > > The fact that we have to drop __GFP_RETRY_MAYFAIL indicates that the > handling there doesn't suffice -- at least for the audio operation. Dropping the retry gfp flag makes no sense without checking fallback in sound allocation context in this thread, nor checking it without checking the costly order in the page allocator. OTOH page allocator will never work in every corner case particularly where perfermance/response is expected given insanely heavy fragmentation background. Fragmentation [1] is not anything new, nor is it a cure to fiddle with a couple flags. [1] https://lore.kernel.org/lkml/20230418191313.268131-1-hannes@cmpxchg.org/