From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 091CBC433FE for ; Mon, 25 Oct 2021 11:20:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 901C660F46 for ; Mon, 25 Oct 2021 11:20:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 901C660F46 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 27211940008; Mon, 25 Oct 2021 07:20:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 221C6940007; Mon, 25 Oct 2021 07:20:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 110F8940008; Mon, 25 Oct 2021 07:20:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 01656940007 for ; Mon, 25 Oct 2021 07:20:43 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B14A0182C37F8 for ; Mon, 25 Oct 2021 11:20:43 +0000 (UTC) X-FDA: 78734717166.18.B8B02E5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf26.hostedemail.com (Postfix) with ESMTP id 2A21720019C0 for ; Mon, 25 Oct 2021 11:20:44 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 207DB1FD3E; Mon, 25 Oct 2021 11:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635160842; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SgccS7iH62TPzdASgUY4+1bxWzoWrC+SmORjKFFwhmE=; b=f04zZ3x96IraB5r5N/NKye85sQDxJcfMc4QHbSXMvRWG9eBPa4/U773x8vvbOUO+/HxLmx wSgFmiM6nfFOrr7kqEFefOrsNZ4th1sNXmfp2oYQu01W9RqdsJDv3+/obfcLGRRZUE+0E/ NRVSjR72lkcytWwMym9dIqzajINScEk= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E71DCA3B81; Mon, 25 Oct 2021 11:20:41 +0000 (UTC) Date: Mon, 25 Oct 2021 13:20:38 +0200 From: Michal Hocko To: Uladzislau Rezki Cc: NeilBrown , Linux Memory Management List , Dave Chinner , Andrew Morton , Christoph Hellwig , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [RFC 2/3] mm/vmalloc: add support for __GFP_NOFAIL Message-ID: References: <20211020192430.GA1861@pc638.lan> <163481121586.17149.4002493290882319236@noble.neil.brown.name> <20211021104038.GA1932@pc638.lan> <163485654850.17149.3604437537345538737@noble.neil.brown.name> <20211025094841.GA1945@pc638.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211025094841.GA1945@pc638.lan> X-Stat-Signature: 7it93hnbib7xpwhczgodpkpiyxkuho4m Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=f04zZ3x9; spf=pass (imf26.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2A21720019C0 X-HE-Tag: 1635160844-205655 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 25-10-21 11:48:41, Uladzislau Rezki wrote: > On Fri, Oct 22, 2021 at 09:49:08AM +1100, NeilBrown wrote: [...] > > If, as you say, the precision doesn't matter that much, then maybe > > msleep(0) > > which would sleep to the start of the next jiffy. Does that look a bit > > weird? If so, the msleep(1) would be ok. > > > Agree, msleep(1) looks much better rather then converting 1 jiffy to > milliseconds. Result should be the same. I would really prefer if this was not the main point of arguing here. Unless you feel strongly about msleep I would go with schedule_timeout here because this is a more widely used interface in the mm code and also because I feel like that relying on the rounding behavior is just subtle. Here is what I have staged now. Are there any other concerns you see with this or other patches in the series? Thanks! --- commit c1a7e40e6b56fed5b9e716de7055b77ea29d89d0 Author: Michal Hocko Date: Wed Oct 20 10:12:45 2021 +0200 fold me "mm/vmalloc: add support for __GFP_NOFAIL" Add a short sleep before retrying. 1 jiffy is a completely random timeout. Ideally the retry would wait for an explicit event - e.g. a change to the vmalloc space change if the failure was caused by the space fragmentation or depletion. But there are multiple different reasons to retry and this could become much more complex. Keep the retry simple for now and just sleep to prevent from hogging CPUs. diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0fb5413d9239..a866db0c9c31 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2944,6 +2944,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, do { ret = vmap_pages_range(addr, addr + size, prot, area->pages, page_shift); + schedule_timeout_uninterruptible(1); } while ((gfp_mask & __GFP_NOFAIL) && (ret < 0)); if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO) @@ -3034,8 +3035,10 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, warn_alloc(gfp_mask, NULL, "vmalloc error: size %lu, vm_struct allocation failed", real_size); - if (gfp_mask & __GFP_NOFAIL) + if (gfp_mask & __GFP_NOFAIL) { + schedule_timeout_uninterruptible(1); goto again; + } goto fail; } -- Michal Hocko SUSE Labs