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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 E94B6C10F27 for ; Tue, 10 Mar 2020 17:39:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B692721D7E for ; Tue, 10 Mar 2020 17:39:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B692721D7E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 77F466B0006; Tue, 10 Mar 2020 13:39:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72C446B0007; Tue, 10 Mar 2020 13:39:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61E816B0008; Tue, 10 Mar 2020 13:39:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 4AD2C6B0006 for ; Tue, 10 Mar 2020 13:39:55 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0BA3B10F1C for ; Tue, 10 Mar 2020 17:39:55 +0000 (UTC) X-FDA: 76580165550.29.quilt30_90c0d7885310f X-HE-Tag: quilt30_90c0d7885310f X-Filterd-Recvd-Size: 4065 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 17:39:54 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id n2so2361391wmc.3 for ; Tue, 10 Mar 2020 10:39:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mi8lNzzOnKeYsD5u8ot6xkdW2xJgJMBQyDw8ffSdpAY=; b=EOrpOQIGkxVJeMSCSCaLgbL8I2HFgI3u0cm4ccH3b7YxAANNSspbqpCeDRlc4rWp65 ypPEBqbCVxEzY4DykxJofytu5F59v5y9MhYvY9NICVBr0l+eQdum2CRxmDT1HjEll0S0 4q2i2nv0QZyNwqwR/WOdKEYkLVfsYjvFD8Ug8ba66NFwsnSO3a45CbVPu2eRpVEfa4UW yPUmcLJt7BU/DD6CKcyDb/hoZKeY78FfYY/tXaLItda+C79QV3As3hAR8AtG4C9MDEUy Y+kFAM0Kr+iqW+sgz/BfxLYmr/lFRE5801KqeS2w1t+yRePz1YoQlmTdVBuOW60s9Egw 7BvQ== X-Gm-Message-State: ANhLgQ1CZehoKDB1NO8Aw780McqQj5DICTlpRbzuoeD8wAmP2gQb09Cu brr0W7xiXS81M8HS4tbgocI= X-Google-Smtp-Source: ADFU+vteQx+Y6fhAAgT08Ei8v41vQmEuC4dL/8yPoVzAOVAO9xUONQ+PcE5PlmBE3Trjkl7MyKgqQQ== X-Received: by 2002:a1c:9c4c:: with SMTP id f73mr3048235wme.125.1583861993519; Tue, 10 Mar 2020 10:39:53 -0700 (PDT) Received: from localhost (ip-37-188-253-35.eurotel.cz. [37.188.253.35]) by smtp.gmail.com with ESMTPSA id q6sm4893875wmj.6.2020.03.10.10.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 10:39:52 -0700 (PDT) Date: Tue, 10 Mar 2020 18:39:51 +0100 From: Michal Hocko To: Roman Gushchin Cc: Andrew Morton , Johannes Weiner , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org, Rik van Riel , Mike Kravetz Subject: Re: [PATCH v2] mm: hugetlb: optionally allocate gigantic hugepages using cma Message-ID: <20200310173951.GX8447@dhcp22.suse.cz> References: <20200310002524.2291595-1-guro@fb.com> <20200310090121.GB8447@dhcp22.suse.cz> <20200310173056.GB85000@carbon.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200310173056.GB85000@carbon.dhcp.thefacebook.com> 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 Tue 10-03-20 10:30:56, Roman Gushchin wrote: > On Tue, Mar 10, 2020 at 10:01:21AM +0100, Michal Hocko wrote: > > On Mon 09-03-20 17:25:24, Roman Gushchin wrote: > > [...] > > > 2) Run-time allocations of gigantic hugepages are performed using the > > > cma allocator and the dedicated cma area > > > > [...] > > > @@ -1237,6 +1246,23 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, > > > { > > > unsigned long nr_pages = 1UL << huge_page_order(h); > > > > > > + if (IS_ENABLED(CONFIG_CMA) && hugetlb_cma[0]) { > > > + struct page *page; > > > + int nid; > > > + > > > + for_each_node_mask(nid, *nodemask) { > > > + if (!hugetlb_cma[nid]) > > > + break; > > > + > > > + page = cma_alloc(hugetlb_cma[nid], nr_pages, > > > + huge_page_order(h), true); > > > + if (page) > > > + return page; > > > + } > > > + > > > + return NULL; > > > > Is there any strong reason why the alloaction annot fallback to non-CMA > > allocator when the cma is depleted? > > The reason is that that gigantic pages allocated using cma require > a special handling on releasing. It's solvable by using an additional > page flag, but because the current code is usually not working except > a short time just after the system start, I don't think it's worth it. I am not deeply familiar with the cma much TBH but cma_release seems to be documented to return false if the area doesn't belong to the area so the free patch can try cma_release and fallback to the regular free, no? -- Michal Hocko SUSE Labs