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=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 2FEE8C433B4 for ; Wed, 19 May 2021 19:52:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94041611B0 for ; Wed, 19 May 2021 19:52:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94041611B0 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 2A7EC6B0072; Wed, 19 May 2021 15:52:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 259B86B0073; Wed, 19 May 2021 15:52:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ABCE6B0074; Wed, 19 May 2021 15:52:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id C81C16B0072 for ; Wed, 19 May 2021 15:52:19 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 556BD181AF5E1 for ; Wed, 19 May 2021 19:52:19 +0000 (UTC) X-FDA: 78159027198.03.85020FD Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf15.hostedemail.com (Postfix) with ESMTP id 145C7A0003B8 for ; Wed, 19 May 2021 19:52:17 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id p20so16973321ljj.8 for ; Wed, 19 May 2021 12:52:18 -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=ACFRqWVclL3GjOA8uYfDIKSmoewur8fyl+9CJwIkoV8=; b=Q+8/nv//kl1pdXF2NhiGsxHdk4rC3fFr4ALonC6Rmxa9A8gb7poO0Yc0lWakFVYdbM 0XNxUpqc9RBK08WDB5gPFqYnBPNGmzskFzZUZTWs/K/+eIPBFMTEm9Z3waJiTPoFnjpj 3uSPCjQrHOjbVPYdf2vZWZS0R/6g++zsm2gMPT3CnN1M1vOeHL/Ke/96pIOFYiEknddt i9jn17hBlHR52/3XVhA/h4ACvkQg5bM9WnSKH4majixMjTxOaXj+z3B3DOa3dEIfv9Ff rnrIXG8vrLgm4M2XyLEzrb1fb4stdP0y7Prcw7TMn5Kt9YXYa7hqaA5nQjI2rUkK4cNG uprA== 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=ACFRqWVclL3GjOA8uYfDIKSmoewur8fyl+9CJwIkoV8=; b=SyWYndh904JHprJKx2LL1/kmzosXN3YA2U8xdpiKWLhTdf2ruuEyxxfpCH4df3kPbh naJmZm2pY9CIGgBms5lc4m8NyfwElXsQ2N9Kg6JYcFxUpO55xeSLamXqrGn2yeloXjS+ 5OlRjs+OLfBJ1fAhcBZ6bUeZyz9xCXaO8C8KgQaamotpVy+H6HIrbepAy4WkL8ZEDMqu OdlMbtP9yAr0ZFU8RyTGshhc63izZkWFKIXI/V5cejXHPNc6gG2IrocI6gmp1884EeqD srH2eYCUxQg86RsokAvRBcZwyBqvnTGr8tftrYcyFZjhEBioCWGp5s8CN6HnzbVavx/j 3I5w== X-Gm-Message-State: AOAM530ReE1JL4Ypjh6CUyR1dehso5+mw9en4NkUTFq9qiQyyqRM6aep slHe+5jBjHAa/jHEZyrpEDs= X-Google-Smtp-Source: ABdhPJz4FAQ7eD8Hkdy/RsERUEH3+kGYwCs1uFu+jRqFvHHUoxYnpxMPkw3bWJHwDDb1PJB248BHKg== X-Received: by 2002:a2e:9615:: with SMTP id v21mr604137ljh.184.1621453937422; Wed, 19 May 2021 12:52:17 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id m4sm23745ljo.127.2021.05.19.12.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 12:52:17 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 19 May 2021 21:52:14 +0200 To: Mel Gorman , Christoph Hellwig Cc: Uladzislau Rezki , Christoph Hellwig , Andrew Morton , linux-mm@kvack.org, LKML , Matthew Wilcox , Nicholas Piggin , Hillf Danton , Michal Hocko , Oleksiy Avramchenko , Steven Rostedt Subject: Re: [PATCH 2/3] mm/vmalloc: Switch to bulk allocator in __vmalloc_area_node() Message-ID: <20210519195214.GA2343@pc638.lan> References: <20210516202056.2120-1-urezki@gmail.com> <20210516202056.2120-3-urezki@gmail.com> <20210519143900.GA2262@pc638.lan> <20210519155630.GD3672@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210519155630.GD3672@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 145C7A0003B8 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="Q+8/nv//"; spf=pass (imf15.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam04 X-Stat-Signature: ukzqiahsw5e11ftta3hcygp476z1r5kj X-HE-Tag: 1621453937-829061 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 Wed, May 19, 2021 at 04:39:00PM +0200, Uladzislau Rezki wrote: > > > > + /* > > > > + * If not enough pages were obtained to accomplish an > > > > + * allocation request, free them via __vfree() if any. > > > > + */ > > > > + if (area->nr_pages != nr_small_pages) { > > > > + warn_alloc(gfp_mask, NULL, > > > > + "vmalloc size %lu allocation failure: " > > > > + "page order %u allocation failed", > > > > + area->nr_pages * PAGE_SIZE, page_order); > > > > + goto fail; > > > > + } > > > > > > From reading __alloc_pages_bulk not allocating all pages is something > > > that cn happen fairly easily. Shouldn't we try to allocate the missing > > > pages manually and/ore retry here? > > > > > > > It is a good point. The bulk-allocator, as i see, only tries to access > > to pcp-list and falls-back to a single allocator once it fails, so the > > array may not be fully populated. > > > > Partially correct. It does allocate via the pcp-list but the pcp-list will > be refilled if it's empty so if the bulk allocator returns fewer pages > than requested, it may be due to hitting watermarks or the local zone is > depleted. It does not take any special action to correct the situation > or stall e.g. wake kswapd, enter direct reclaim, allocate from a remote > node etc. > > If no pages were allocated, it'll try allocate at least one page via a > single allocation request in case the bulk failure would push the zone > over the watermark but 1 page does not. That path as a side-effect would > also wake kswapd. > OK. A single page allocator can enter a slow path i mean direct reclaim, etc to adjust watermarks. > > In that case probably it makes sense to manually populate it using > > single page allocator. > > > > Mel, could you please also comment on it? > > > > It is by design because it's unknown if callers can recover or if so, > how they want to recover and the primary intent behind the bulk allocator > was speed. In the case of network, it only wants some pages quickly so as > long as it gets 1, it makes progress. For the sunrpc user, it's willing > to wait and retry. For vmalloc, I'm unsure what a suitable recovery path > should be as I do not have a good handle on workloads that are sensitive > to vmalloc performance. The obvious option would be to loop and allocate > single pages with alloc_pages_node understanding that the additional > pages may take longer to allocate. > I got it. At least we should fall-back for a single allocator, that is how we used to allocate before(now it is for high-order pages). If it also fails to obtain a page we are done. Basically a single-page allocator is more permissive so it is a higher chance to success. Therefore a fallback to it makes sense. Thanks. -- Vlad Rezki