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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E372C4CECE for ; Mon, 14 Oct 2019 14:27:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5126F2089C for ; Mon, 14 Oct 2019 14:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PFwXYPlR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5126F2089C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E264E8E0005; Mon, 14 Oct 2019 10:27:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1468E0001; Mon, 14 Oct 2019 10:27:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C79608E0005; Mon, 14 Oct 2019 10:27:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id A7C3E8E0001 for ; Mon, 14 Oct 2019 10:27:31 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 26DCC180AD83B for ; Mon, 14 Oct 2019 14:27:31 +0000 (UTC) X-FDA: 76042618302.21.drain37_24760b6d7d554 X-HE-Tag: drain37_24760b6d7d554 X-Filterd-Recvd-Size: 6070 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Oct 2019 14:27:30 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id b20so16870936ljj.5 for ; Mon, 14 Oct 2019 07:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TgrcIbV4YUcVsIR4rlX/SsLkjeCAujElMOWkAWBGi7g=; b=PFwXYPlRDvYa3/dGwTKj7ZAZAODdkGeZkahGFcaIo1u/nGTYOL7m7VcGZZUunTzFaz 1S3TSJnzqxerg1TLxpuWDhfW0RMHlLKVT6JjxjZCCvDsAapO3NG3aILKJ+SXG35ALoIR DqL0GcSZP08B2NLEK36AEiG2tOuW3ek5rSVHWCCEKHLP07PUFA1kEyp5iAXg8LuUZbQn nWRpzhICZcFNltFUQ8PAbpLhvnxyqFr8qP0WbTPPn6RhSqViDb+WfTVKbOEfLKBfOpSx xncS8QOM/yhuqRPY5VuKE47uRU1nmbidY+bI7RaLjtg1btUjHfHpEU6u2KDtVsTGmIj0 00TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TgrcIbV4YUcVsIR4rlX/SsLkjeCAujElMOWkAWBGi7g=; b=ROVlG+SKg2qEOi+2mNQHt8vxKJIm0277JL5AhQ5xS/LdZB8uMCXIEvEtXVxaoJfc4L +1DxXp3+9Dmue7ApXBkA81tPQXv050ZLy3pDY4y0mKYfccv07R2WRuLWxLMnfnxqqz7U q9ISnA8AzlkVZqCX70Vtakg7W1wyBjYfyk/vo+TfXflZOmvHvCpZEKwfeT1Xb2UoiT2V BgcCGREnga5mpPutDJBwcAb3JGkctpVxHFnjWpp00/TPI81647Q53mOOipxhlMXuoqab pba1SDG4KihDbpLmuTAYCO5s5kn2gKo+NoCFZeKGxdnUXqVVnXPjH9PAL+cwtMuq95gl vh4Q== X-Gm-Message-State: APjAAAVD69zJpTRao79zzubp4HLrRjZMZotLS4BVAfDkIJZ5HZvUd/Mq SJrInCS9SPE1Hrgw2lVr1Q4= X-Google-Smtp-Source: APXvYqxZ9RrwgIeT0+NIEPfGYmuMqEMTvaHl9/8Jdp7w4rDkTn9aVL+blgOdno1eQyX/+0XKkN31WQ== X-Received: by 2002:a2e:95d9:: with SMTP id y25mr19225662ljh.217.1571063248736; Mon, 14 Oct 2019 07:27:28 -0700 (PDT) Received: from pc636 ([37.139.158.167]) by smtp.gmail.com with ESMTPSA id s26sm4339518lfc.60.2019.10.14.07.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 07:27:27 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 14 Oct 2019 16:27:19 +0200 To: Andrew Morton Cc: Uladzislau Rezki , Steven Rostedt , Daniel Wagner , Sebastian Andrzej Siewior , Thomas Gleixner , linux-mm@kvack.org, LKML , Peter Zijlstra , Hillf Danton , Michal Hocko , Matthew Wilcox , Oleksiy Avramchenko Subject: Re: [PATCH 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading Message-ID: <20191014142719.GA17874@pc636> References: <20191009164934.10166-1-urezki@gmail.com> <20191009151901.1be5f7211db291e4bd2da8ca@linux-foundation.org> <20191009221725.0b83151e@oasis.local.home> <20191010151749.GA14740@pc636> <20191011165515.a25e7d1c22e6b5e3e6fb69da@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191011165515.a25e7d1c22e6b5e3e6fb69da@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Fri, Oct 11, 2019 at 04:55:15PM -0700, Andrew Morton wrote: > On Thu, 10 Oct 2019 17:17:49 +0200 Uladzislau Rezki wrote: > > > > > : * The preload is done in non-atomic context, thus it allows us > > > > : * to use more permissive allocation masks to be more stable under > > > > : * low memory condition and high memory pressure. > > > > : * > > > > : * Even if it fails we do not really care about that. Just proceed > > > > : * as it is. "overflow" path will refill the cache we allocate from. > > > > : */ > > > > : if (!this_cpu_read(ne_fit_preload_node)) { > > > > > > > > Readability nit: local `pva' should be defined here, rather than having > > > > function-wide scope. > > > > > > > > : pva = kmem_cache_alloc_node(vmap_area_cachep, GFP_KERNEL, node); > > > > > > > > Why doesn't this honour gfp_mask? If it's not a bug, please add > > > > comment explaining this. > > > > > > But there is a comment, if understand you correctly: > > > > > > * Even if it fails we do not really care about that. Just proceed > > * as it is. "overflow" path will refill the cache we allocate from. > > > > My point is that the alloc_vmap_area() caller passed us a gfp_t but > this code ignores it, as does adjust_va_to_fit_type(). These *look* > like potential bugs. If not, they should be commented so they don't > look like bugs any more ;) > I got it, there was misunderstanding from my side :) I agree. In the first case i should have used and respect the passed "gfp_mask", like below: diff --git a/mm/vmalloc.c b/mm/vmalloc.c index f48cd0711478..880b6e8cdeae 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1113,7 +1113,8 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, * Just proceed as it is. If needed "overflow" path * will refill the cache we allocate from. */ - pva = kmem_cache_alloc_node(vmap_area_cachep, GFP_KERNEL, node); + pva = kmem_cache_alloc_node(vmap_area_cachep, + gfp_mask & GFP_RECLAIM_MASK, node); spin_lock(&vmap_area_lock); It should be sent as a separate patch, i think. As for adjust_va_to_fit_type(), i can add a comment, since we can not sleep there and the case is one per 1000000 or even lower with your proposal. Does it sound good? Thank you! -- Vlad Rezki