Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp170918pxb; Fri, 29 Oct 2021 07:47:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweIzgldnZxOvMUdrezZxDOePp2lHPEp7TxHyxoNLhPHkpBS3hpuHR4jYxn1vW5m3+lGPKi X-Received: by 2002:aa7:da16:: with SMTP id r22mr15872917eds.75.1635518859504; Fri, 29 Oct 2021 07:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635518859; cv=none; d=google.com; s=arc-20160816; b=yBdWpczTAz6PVPFNq6aGaRuLUhMbrPPFX3Y7U9Sdx+GdTOX50r2Ow0fX1cNjtL3m4I Ga7qINXMatCKsPOmlrQDqzCLZFVgmHLUP5n0lV8p84DYzuZ3LFNVuG27dIyQnPNM5l/c 1aJYIjx+eBbMVmaYoaFVTvDivO66rt5yNYhRxc3XJNFxjCtE4d9geDj6ou6k/3Q690nQ 3aZFxfwJJW6obC0Cjr4cYAQpacWEqTYlHZhHZnQDJN3P+2/H9cAW8Xh7tABTAa4seyjE tceBK8LIu7e+41Dqj+Bj+jslFvjM7yiZ1XgOhCsVJ2tGxeGQhAHczy7PyL4GF6729xPz gFVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g1/0tWG/oKUZOJcGNfnoYQFpXXezjJ1VuVMjD4tPxqM=; b=OTggkWy7I4udsOgmZzpNylDO9K2tfqs9O0XD0PW422UBODuJlKtSFOBEogH7+kcBkU CO+Fz3kXpZv2LXCu28i4nwtv/HyR+U+ziG4nwX2AhKJO0VtiqNzFuQjcczmhqijVzaTF /w7edXoEv1oUOeAuaxY0qSHNP1VjF3zauPm9Zd/L+cfG+2XkXwXMC8QJPzW50rt0+Ijd 4JLWr5QAVshlfJTRw9rqwFjj6hfDcbOTSRCc4JV4jCH9mZfPG3yKMl3pURIHwy0gZ0De 0mN73Hzd+wdz1BhbyMZxSFk0TcxgJLywmQDW9KGGamP8vKbVIOBtReF5BFLw0OG/LJbN EBkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=rkUaNJDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce13si9233135edb.153.2021.10.29.07.47.08; Fri, 29 Oct 2021 07:47:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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.com header.s=susede1 header.b=rkUaNJDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbhJ2Ore (ORCPT + 99 others); Fri, 29 Oct 2021 10:47:34 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:57864 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbhJ2Ord (ORCPT ); Fri, 29 Oct 2021 10:47:33 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 838231FD51; Fri, 29 Oct 2021 14:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635518704; 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=g1/0tWG/oKUZOJcGNfnoYQFpXXezjJ1VuVMjD4tPxqM=; b=rkUaNJDo7doW7mmhhiDH23/fksZk9/bMewZMBKvw02s5xGKVCoudDBJeVnactwhApDzRwr OI0C5as/v7+QVSF+ha+hHzbuqZxPwcjsgaLG4Qe8DlVjFknnk/wGBfoq5ay8+iOEOI5xp9 zC7B3XezoovoCrndutFf6IWjryp3H2g= 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 549CAA3B84; Fri, 29 Oct 2021 14:45:04 +0000 (UTC) Date: Fri, 29 Oct 2021 16:45:03 +0200 From: Michal Hocko To: Uladzislau Rezki Cc: Linux Memory Management List , Dave Chinner , Neil Brown , Andrew Morton , Christoph Hellwig , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [PATCH 2/4] mm/vmalloc: add support for __GFP_NOFAIL Message-ID: References: <20211025150223.13621-1-mhocko@kernel.org> <20211025150223.13621-3-mhocko@kernel.org> <20211026193315.GA1860@pc638.lan> <20211027175550.GA1776@pc638.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 29-10-21 16:05:32, Uladzislau Rezki wrote: [...] > > OK, this looks easier from the code reading but isn't it quite wasteful > > to throw all the pages backing the area (all of them allocated as > > __GFP_NOFAIL) just to then fail to allocate few page tables pages and > > drop all of that on the floor (this will happen in __vunmap AFAICS). > > > > I mean I do not care all that strongly but it seems to me that more > > changes would need to be done here and optimizations can be done on top. > > > > Is this something you feel strongly about? > > > Will try to provide some motivations :) > > It depends on how to look at it. My view is as follows a more simple code > is preferred. It is not considered as a hot path and it is rather a corner > case to me. Yes, we are definitely talking about corner cases here. Even GFP_KERNEL allocations usually do not fail. > I think "unwinding" has some advantage. At least one motivation > is to release a memory(on failure) before a delay that will prevent holding > of extra memory in case of __GFP_NOFAIL infinitelly does not succeed, i.e. > if a process stuck due to __GFP_NOFAIL it does not "hold" an extra memory > forever. Well, I suspect this is something that we can disagree on and both of us would be kinda right. I would see it as throwing baby out with the bathwater. The vast majority of the memory will be in the area pages and sacrificing that just to allocate few page tables or whatever that might fail in that code path is just a lot of cycles wasted. So unless you really feel strongly about this then I would stick with this approach. -- Michal Hocko SUSE Labs