Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5307591imm; Tue, 16 Oct 2018 08:18:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV61cY9s52FykqGpCVg8Vc5ReCLVzqZIAhHPoBM3+/mFuy/ZY91rS0UxC3T4o4N5zn6ArKjSA X-Received: by 2002:a17:902:9:: with SMTP id 9-v6mr21974488pla.293.1539703120185; Tue, 16 Oct 2018 08:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539703120; cv=none; d=google.com; s=arc-20160816; b=otSR3ttynNLvCDQlKQkROJ/lS9TE3jV72AOGQbN9+vg2JE2oIw7qTcfwwiU04+0bam ZEypX71r1smzztknGSNOhgvau5CSIZoesNvKdNHOkUQel4uxkK090irEULnmJLx1+EyW acThJ3AW5lz33bXgcuxlpCKUp1q126JMdqTRZAooga3dbMHQCOeFOapbX3Qid7nh7Ivd eXtVV2kDqlZlmsJQiYTSZtsP1hYax8uDt2F2jAo/+2dR6Q/r28rvsrqydnylF1wzpS4e DDyQSzIb3Jgk6aTRaccKPAysg0syXbUlRsQFQXyOYeRdqCclCnx+r9DyvNH4xHhcq1/z UfdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=iczZAZNnmNLjDHKgWTSgJWcT63uUSwCZWxUKico/7zU=; b=XhAj1YSM2wv2WIq7UWpfHjTRFrtkgfF6gy8syKiGCD7lVTkNQw/KTC84mDzfmae3dp XFQPTQrqueSDVO4FkRdqFUR0PoCk7LOcw6DHNUxCThnsYRUGiCcKwl8RNEkNSAsUPsKn liHHsMaiGG5t1+NLDRC0IaGMuuppobFVJDeI53L2XX0a7gIZHc2tOXyzlO6SmrJ4suI6 PwpS8Je/VjHCpGdg1JKxWf4hlCmGFufv/ALhCPfgSnq7JBvW8zy56jUb7AsWqmUDicqE T12BqN12AeY0uU7av49ux5BX+i3zzTKnlWAIik+wIfcPYm8LB8VkxQY6hwFwdSdwDNrO VBlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=ASgBWw3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16-v6si14345393pgb.404.2018.10.16.08.18.24; Tue, 16 Oct 2018 08:18:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=ASgBWw3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbeJPXIx (ORCPT + 99 others); Tue, 16 Oct 2018 19:08:53 -0400 Received: from a9-114.smtp-out.amazonses.com ([54.240.9.114]:58740 "EHLO a9-114.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbeJPXIx (ORCPT ); Tue, 16 Oct 2018 19:08:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1539703076; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=zisL8ov3KWgOHzFU/T/9Xg/6fw08V8Px6ZPEYvtNj7Q=; b=ASgBWw3jDOL8TKeDbOYwCa02AaGBGhDgP2fKf1E4yTa9bKQJ3iIzOzSbtYr2jU/S 3ck7EIf6O34idAuZm1UnjdXoglEsVwUTqscN6OrikeyHgi9v/cfhJQM0H8mE5VkZF/s 4iAP6DkaYQqOeSDvixJJulzERDJ1v2sTQO01f1gk= Date: Tue, 16 Oct 2018 15:17:56 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: David Rientjes cc: Andrew Morton , Pekka Enberg , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch] mm, slab: avoid high-order slab pages when it does not reduce waste In-Reply-To: Message-ID: <010001667d7476a2-f91dcf12-5e90-4ade-97e8-9fd651f7bf17-000000@email.amazonses.com> References: <20181012151341.286cd91321cdda9b6bde4de9@linux-foundation.org> <0100016679e3c96f-c78df4e2-9ab8-48db-8796-271c4b439f16-000000@email.amazonses.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.10.16-54.240.9.114 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Oct 2018, David Rientjes wrote: > On Mon, 15 Oct 2018, Christopher Lameter wrote: > > > > > If the amount of waste is the same at higher cachep->gfporder values, > > > > there is no significant benefit to allocating higher order memory. There > > > > will be fewer calls to the page allocator, but each call will require > > > > zone->lock and finding the page of best fit from the per-zone free areas. > > > > There is a benefit because the management overhead is halved. > > > > It depends on (1) how difficult it is to allocate higher order memory and > (2) the long term affects of preferring high order memory over order 0. The overhead of the page allocator is orders of magnitudes bigger than slab allocation. Higher order may be faster because the pcp overhead is not there. It all depends. Please come up with some benchmarking to substantiate these ideas. > > For (1), slab has no minimum order fallback like slub does so the > allocation either succeeds at cachep->gfporder or it fails. If memory > fragmentation is such that order-1 memory is not possible, this is fixing > an issue where the slab allocation would succeed but now fails > unnecessarily. If that order-1 memory is painful to allocate, we've > reclaimed and compacted unnecessarily when order-0 pages are available > from the pcp list. > Ok that sounds good but the performance impact is still an issue. Also we agreed that the page allocator will provide allocations up to COSTLY_ORDER without too much fuss. Other system components may fail if these smaller order pages are not available. > > Have a benchmark that shows this? > > > > I'm not necessarily approaching this from a performance point of view, but > rather as a means to reduce slab fragmentation when fallback to order-0 > memory, especially when completely legitimate, is prohibited. From a > performance standpoint, this will depend on separately on fragmentation > and contention on zone->lock which both don't exist for order-0 memory > until fallback is required and then the pcp are filled with up to > batchcount pages. Fragmentation is a performance issue and causes degradation of Linux MM performance over time. There are pretty complex mechanism that need to be played against one another. Come up with some metrics to get meaningful data that allows us to see the impact. I think what would be beneficial to have is a load that gradually degrade as another process causes fragmentation. Any patch like the one proposed should have an effect on the degree of fragmentation after a certain time. Having something like that could lead to a whole serial of optimizations. Ideally we would like to have a MM subsystem that does not degrade as today.