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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 8C7B7C433DF for ; Tue, 18 Aug 2020 16:49:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4BDB2207D3 for ; Tue, 18 Aug 2020 16:49:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dhLluJGa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BDB2207D3 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 EEFB08D002A; Tue, 18 Aug 2020 12:49:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC5DD8D0001; Tue, 18 Aug 2020 12:49:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDF998D002A; Tue, 18 Aug 2020 12:49:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id C7C448D0001 for ; Tue, 18 Aug 2020 12:49:42 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6ECEB824805A for ; Tue, 18 Aug 2020 16:49:42 +0000 (UTC) X-FDA: 77164275804.17.glass17_4b0890627020 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 0632C180D018B for ; Tue, 18 Aug 2020 16:49:39 +0000 (UTC) X-HE-Tag: glass17_4b0890627020 X-Filterd-Recvd-Size: 5349 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 16:49:38 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id r4so9485850pls.2 for ; Tue, 18 Aug 2020 09:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ogtP1NvhLy2kuSoHsKUMbMaNvST1++BE4vJChfcrAAU=; b=dhLluJGaI+H/VU1hzRcNC+rS4BvpEL4AOAe+TG6/X2CsCBuv4XEBdbtrSgcmrnxNYD r15IARG38Y/73bRmZ44CEiAXT2IfYYOEpnQ5rqCBPy9K+a0+MMCv2Syw8elgS1Bk/i+6 CTLBM7GG6pAdqgdVpsgp6HPsua6/jqJY3J9VNW8klMWNBY+uHCNpAWNXPXZJgowN5Vpt FhBGvjaKmk2Yl+tLqFkZkQ6OrI2t14nJfeMQzGA/erc17Yk8RfAuVuQ+fGMnjJLby8NH 3a/KMiQiFa0So3wa3mh2ZmiuITLONQQ1TIycgImKDxF4tmXWZ1X5moby1GJ5zdnDhol1 k5aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=ogtP1NvhLy2kuSoHsKUMbMaNvST1++BE4vJChfcrAAU=; b=a554kX4dcWj3pY+XxGMMNWd67puSeye3mk3frKIrllc+1SayUwFq8gsRq/EEonfD/A hgf8/M43gJ3JogwoIZOjcBDA4qfIcuvacmB2DLbmTa9cM20o7gJVS5eBKwP04dN4NCJX qsBJFXJiDW4gG8y5ohHhzQhR8Pc+iBnmaShI0v8Wm7e2lwM9hMoGfiZLvMfG0MICNgGS yjiQnWAabvjwcrGV7SPIP++hJi8GHhvyRKg/gKmG3wL9Mz7mjq8Een4Of2PoanmdKsZF T+FTDtdrxdvx1ipO7BOxxAKfOJUDpTDIJ045Z8RorTsNsGZnF2LB68irBKzmSa75oFSg VDrw== X-Gm-Message-State: AOAM533vPkBlyurcK3A2A7Jrm2jZ0qThKlGcvFE69MkRyaTVYWRELJ/w RZsdY+b9Hk9rFKNdMMjGBUI= X-Google-Smtp-Source: ABdhPJz9y8efhz84TGOM6l0ei/MJJLLZG0iBiQaQx4kGYxnRFuaMQC2bKvT5PQr3loTf7kBIDt9qmg== X-Received: by 2002:a17:90b:4b81:: with SMTP id lr1mr672599pjb.71.1597769377087; Tue, 18 Aug 2020 09:49:37 -0700 (PDT) Received: from google.com ([2620:15c:211:1:7220:84ff:fe09:5e58]) by smtp.gmail.com with ESMTPSA id r28sm25331653pfg.158.2020.08.18.09.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 09:49:35 -0700 (PDT) Date: Tue, 18 Aug 2020 09:49:34 -0700 From: Minchan Kim To: David Hildenbrand Cc: Matthew Wilcox , Andrew Morton , linux-mm , Joonsoo Kim , Vlastimil Babka , John Dias , Suren Baghdasaryan , pullip.cho@samsung.com, Chris Goldsworthy , Nicholas Piggin Subject: Re: [RFC 0/7] Support high-order page bulk allocation Message-ID: <20200818164934.GF3852332@google.com> References: <4e2bd095-b693-9fed-40e0-ab538ec09aaa@redhat.com> <20200817152706.GB3852332@google.com> <20200817163018.GC3852332@google.com> <20200817233442.GD3852332@google.com> <7c07e8cf-6adc-92be-d819-d60a389559d8@redhat.com> <20200818151543.GE3852332@google.com> <20200818155825.GS17456@casper.infradead.org> <2d835b0c-da48-52d1-1792-255bbad3425d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d835b0c-da48-52d1-1792-255bbad3425d@redhat.com> X-Rspamd-Queue-Id: 0632C180D018B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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, Aug 18, 2020 at 06:22:10PM +0200, David Hildenbrand wrote: > On 18.08.20 17:58, Matthew Wilcox wrote: > > On Tue, Aug 18, 2020 at 08:15:43AM -0700, Minchan Kim wrote: > >> I understand pfn stuff in the API is not pretty but the concept of idea > >> makes sense to me in that go though the *migratable area* and get possible > >> order pages with hard effort. It looks like GFP_NORETRY version for > >> kmem_cache_alloc_bulk. > >> > >> How about this? > >> > >> int cma_alloc(struct cma *cma, int order, unsigned int nr_elem, struct page **pages); > > > > I think that makes a lot more sense as an API. Although I think you want > > > > int cma_bulk_alloc(struct cma *cma, unsigned order, unsigned nr_elem, > > struct page **pages); > > > > Right, and I would start with a very simple implementation that does not > mess with alloc_contig_range() (meaning: modify it). > > I'd then much rather want to see simple tweaks to alloc_contig_range() > to improve the situation. E.g., some kind of "fail fast" flag that let's > the caller specify to skip some draining (or do it manually in cma > before a bulk allocation) and rather fail fast than really trying to > allocate the range whatever it costs. > > There are multiple optimizations you can play with then (start with big > granularity and split, move to smaller granularity on demand, etc., all > nicely wrapped in cma_bulk_alloc()). Okay, let me hide the detail inside cma_bulk_alloc as much as possible. Anyway, at least we need to pass some flag to indicate "fail fast" in alloc_contig_range. Maybe __GFP_NORETRY could carry on the indication. Thanks for the review.