From patchwork Sun Dec 1 01:54:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11268357 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CDBC921 for ; Sun, 1 Dec 2019 01:54:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28BA520880 for ; Sun, 1 Dec 2019 01:54:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ofMpfTGs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28BA520880 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EF9486B030B; Sat, 30 Nov 2019 20:54:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EA8436B030D; Sat, 30 Nov 2019 20:54:42 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0D096B030E; Sat, 30 Nov 2019 20:54:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id CF7526B030B for ; Sat, 30 Nov 2019 20:54:42 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 7B18E181AEF0B for ; Sun, 1 Dec 2019 01:54:42 +0000 (UTC) X-FDA: 76214903604.23.pig94_291323d99361e X-Spam-Summary: 2,0,0,612f007409ebfd89,d41d8cd98f00b204,akpm@linux-foundation.org,:akpm@linux-foundation.org:bigeasy@linutronix.de:dwagner@suse.de:hdanton@sina.com::mhocko@suse.com:mm-commits@vger.kernel.org:oleksiy.avramchenko@sonymobile.com:peterz@infradead.org:rostedt@goodmis.org:tglx@linutronix.de:torvalds@linux-foundation.org:urezki@gmail.com:willy@infradead.org,RULES_HIT:41:355:379:800:960:966:967:973:988:989:1260:1263:1345:1381:1431:1437:1534:1542:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3151:3353:3503:3504:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:5007:6261:6653:6737:6755:7514:7576:8599:9025:9545:10004:10913:11026:11473:11658:11914:12043:12048:12114:12219:12296:12297:12438:12517:12519:12555:12679:12783:12986:13161:13229:13846:14096:14181:14721:14849:21080:21324:21433:21451:21600:21627:21939:30054:30074,0 ,RBL:err X-HE-Tag: pig94_291323d99361e X-Filterd-Recvd-Size: 3733 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:54:42 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14D5D2084D; Sun, 1 Dec 2019 01:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575165281; bh=4Ei9u6EdIshRDgIIneK55ObFablUeWubKpy9n77vs/g=; h=Date:From:To:Subject:From; b=ofMpfTGsCGFZF/AVZezu8SMqk1C/qNktKLQXM2BG5re3fdIZQPnmge8NFtLXCcBg/ Rf8lXYkd2LXkISpki0n4GG9hOr2u4ISBVEmKrTiK+Un99/65tLSXyVsgQjqt2oaOfu Biyl2VglYHqkUPKW9YeqnacFGfSbeD+tnxiIlsaI= Date: Sat, 30 Nov 2019 17:54:40 -0800 From: akpm@linux-foundation.org To: akpm@linux-foundation.org, bigeasy@linutronix.de, dwagner@suse.de, hdanton@sina.com, linux-mm@kvack.org, mhocko@suse.com, mm-commits@vger.kernel.org, oleksiy.avramchenko@sonymobile.com, peterz@infradead.org, rostedt@goodmis.org, tglx@linutronix.de, torvalds@linux-foundation.org, urezki@gmail.com, willy@infradead.org Subject: [patch 090/158] mm/vmalloc: add more comments to the adjust_va_to_fit_type() Message-ID: <20191201015440.p_aqbgBSe%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: "Uladzislau Rezki (Sony)" Subject: mm/vmalloc: add more comments to the adjust_va_to_fit_type() When fit type is NE_FIT_TYPE there is a need in one extra object. Usually the "ne_fit_preload_node" per-CPU variable has it and there is no need in GFP_NOWAIT allocation, but there are exceptions. This commit just adds more explanations, as a result giving answers on questions like when it can occur, how often, under which conditions and what happens if GFP_NOWAIT gets failed. Link: http://lkml.kernel.org/r/20191016095438.12391-3-urezki@gmail.com Signed-off-by: Uladzislau Rezki (Sony) Acked-by: Michal Hocko Cc: Daniel Wagner Cc: Sebastian Andrzej Siewior Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Uladzislau Rezki Cc: Hillf Danton Cc: Michal Hocko Cc: Matthew Wilcox Cc: Oleksiy Avramchenko Cc: Steven Rostedt Signed-off-by: Andrew Morton --- mm/vmalloc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/mm/vmalloc.c~mm-vmalloc-add-more-comments-to-the-adjust_va_to_fit_type +++ a/mm/vmalloc.c @@ -968,6 +968,19 @@ adjust_va_to_fit_type(struct vmap_area * * There are a few exceptions though, as an example it is * a first allocation (early boot up) when we have "one" * big free space that has to be split. + * + * Also we can hit this path in case of regular "vmap" + * allocations, if "this" current CPU was not preloaded. + * See the comment in alloc_vmap_area() why. If so, then + * GFP_NOWAIT is used instead to get an extra object for + * split purpose. That is rare and most time does not + * occur. + * + * What happens if an allocation gets failed. Basically, + * an "overflow" path is triggered to purge lazily freed + * areas to free some memory, then, the "retry" path is + * triggered to repeat one more time. See more details + * in alloc_vmap_area() function. */ lva = kmem_cache_alloc(vmap_area_cachep, GFP_NOWAIT); if (!lva)