Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1276977imm; Fri, 12 Oct 2018 15:14:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jHn0p8Z/VWxOKGaiqONWofRg4KhcijphP5o2OOA96DrWJhXBsIhJv0d+v4GCIXTcXMRSS X-Received: by 2002:a65:580d:: with SMTP id g13-v6mr6648460pgr.370.1539382460500; Fri, 12 Oct 2018 15:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539382460; cv=none; d=google.com; s=arc-20160816; b=gvGCOYRukTlVQZZq7Hyaz4QaDZg2D+Ud5r8fUaBSxDMghfOISQth4j98ny5b6EGyJG re8MRiUK/AvI7Dwxwv+2ZgwgebJSXEFtUbE4qJRWMd124rlad/ZbyZ6A5DS7IUZ2XAfm NLVS8oscUNuYYGBLj0Drumq9rwsBaEPm1c3WvRx09WptNrV0mc9v9FZOp6RH+6XQ/g6D Jaw3KfsMNjDF1y9L1U5GbPyjb2Or/9XlfCTfX82Cp40R1Rhi3bS8Ug/FgQPEbkdKQh+z 2vkbDFBvxwBDsCdGHgVS28n4iOA4IHUpoul0E1HmqFtZ2oQRUNa6ii+R4iQ5Ub+dNuro Jv0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=d4+hQY6KVAUHefoCIgTLBr+StZrp16ASKVdp0Q4JNuY=; b=gS6qMFY5dguJYrGFrhFvtGYauZsan5jVMMqKo+cot52kGa1LH1SLF8H8e+sf97i9KE ISwI0/pHi1MAeeLWkvG6vlpG/kYmlzKm1x0A1TEVSzl9TLhvT4x73Orr5gI9Tm0SccPn CCPAjE2iyPmnZUyL02m1HTlQmqV9Ww3lpbCdTqn+YvO6KDQTMQSOB2/otvdPP7Sam1Uf Q9TVWrrtLXrCi0ylUR68hAkmXFOdIAYOmwZyOX4esMiv+U+Kd39U2u5OB7biaf/M/7eT kWweEPW1kU50gXX9c6x/owSWE6aDVWpqi5KbEKkX6vhiF8FaqZq1peQftDLxH1TUWBXN GhCw== ARC-Authentication-Results: i=1; mx.google.com; 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 u19-v6si2462838pgg.221.2018.10.12.15.14.05; Fri, 12 Oct 2018 15:14:20 -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; 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 S1725986AbeJMFsO (ORCPT + 99 others); Sat, 13 Oct 2018 01:48:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43478 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbeJMFsO (ORCPT ); Sat, 13 Oct 2018 01:48:14 -0400 Received: from localhost.localdomain (c-24-4-154-175.hsd1.ca.comcast.net [24.4.154.175]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A76C0D93; Fri, 12 Oct 2018 22:13:43 +0000 (UTC) Date: Fri, 12 Oct 2018 15:13:41 -0700 From: Andrew Morton To: David Rientjes Cc: Christoph Lameter , 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 Message-Id: <20181012151341.286cd91321cdda9b6bde4de9@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Oct 2018 14:24:57 -0700 (PDT) David Rientjes wrote: > The slab allocator has a heuristic that checks whether the internal > fragmentation is satisfactory and, if not, increases cachep->gfporder to > try to improve this. > > 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. > > Instead, it is better to allocate order-0 memory if possible so that pages > can be returned from the per-cpu pagesets (pcp). > > There are two reasons to prefer this over allocating high order memory: > > - allocating from the pcp lists does not require a per-zone lock, and > > - this reduces stranding of MIGRATE_UNMOVABLE pageblocks on pcp lists > that increases slab fragmentation across a zone. Confused. Higher-order slab pages never go through the pcp lists, do they? I'd have thought that by tending to increase the amount of order-0 pages which are used by slab, such stranding would be *increased*? > We are particularly interested in the second point to eliminate cases > where all other pages on a pageblock are movable (or free) and fallback to > pageblocks of other migratetypes from the per-zone free areas causes > high-order slab memory to be allocated from them rather than from free > MIGRATE_UNMOVABLE pages on the pcp. > > mm/slab.c | 15 +++++++++++++++ Do slub and slob also suffer from this effect?