From patchwork Mon Jun 3 04:26:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tobin C. Harding" X-Patchwork-Id: 10972201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33E1F14DB for ; Mon, 3 Jun 2019 04:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 244A428174 for ; Mon, 3 Jun 2019 04:27:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1438F28387; Mon, 3 Jun 2019 04:27:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A330F28174 for ; Mon, 3 Jun 2019 04:27:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 800F86B026E; Mon, 3 Jun 2019 00:27:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7B1CF6B026F; Mon, 3 Jun 2019 00:27:57 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A0126B0270; Mon, 3 Jun 2019 00:27:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 491ED6B026E for ; Mon, 3 Jun 2019 00:27:57 -0400 (EDT) Received: by mail-qk1-f197.google.com with SMTP id v4so13725216qkj.10 for ; Sun, 02 Jun 2019 21:27:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jGU9saE69a/gfeKWv7WhcnJU8nruwl7/fOnxwG1r6J8=; b=dBN4XmfhbeZrW9pekC1s+97mEqQUEOrMF27mWCFcX+v2z9eETiemx6gp2kbKAE1gPW ihlLM6hQ4+2HVJh2AMjvRAGc+uDnhOoWgug43rYEo8cCQk4qwO6DsUmFnRjDHK2UhGhm eU6zNHaFWRk0zNz6ejoSr4gc40uHKz44rYe7b+zNmS8gY/yjg2pQiiaSLzPvYRjvHX1K aImOQTFaax59DZCSK1pxLZhl6SzDYgZhneru5433wFQAqmdWvbJpFmZFYse/lkLG97F+ E2OGYrzvr9mDt/Hh9YmurjMByjSvTFq5uIbIcOMcye2kn4SYKP4KL3P+Wr55ihTdZN9+ 9EdA== X-Gm-Message-State: APjAAAWBcVaQE8x4xubfb9bRFhN2NW9x3dtHFA9hXhiK95gzUWgyhVAX CilNMLvQZ7ZdujpdsZ6iX9akRpd2k+H3bPQZV0MvoPyF4iNfZXeB3Y/0wzvbQDiASA5vXrW5eDG ZhJ+wHZvJ0sALJXj7xyNVrv3uBCSbZJeWwSZYGSa2It+wqHO8XY53SIrSY3qKY9o= X-Received: by 2002:ac8:374b:: with SMTP id p11mr20363240qtb.316.1559536077038; Sun, 02 Jun 2019 21:27:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHjx+Zqnu61NnZcpGoXSqZgFM7tNaCAEV0w8xDJ1p1vzfhZd6NUKTItWkgCFowHWnqDhlY X-Received: by 2002:ac8:374b:: with SMTP id p11mr20363211qtb.316.1559536076183; Sun, 02 Jun 2019 21:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559536076; cv=none; d=google.com; s=arc-20160816; b=Xcvy58p40uUobexFLUecMdgMIt3M2S/MHUtxTFhoAS5M+TDAnG+/nhlD8FwZj7944J mVlkDisVhvCyZ7R3HuiCN56s8HZSk/S0Lf0egEYNAOp11pRIUiuyG0j0a44K0fCpi7UO 2w+VqRZcOBK74hfMUqwhANtlmSBhSDM0hR3xFXGLSliBfJcdIBNQ9pqoZ6Kb2iP80SO4 ZI8ojYWtnQnjX0NzlcDRp0EG5b/ztJP4VgVge3XMRjLkIkgg3tZOUt1ZgXo/30q00Hg0 zSddNqbwDFTY5R7vu6Z5Kv//InRB2T/ocf/eJvXiA15IwQTk6dkoAc8Eq/9Wo1BK1rop vMSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jGU9saE69a/gfeKWv7WhcnJU8nruwl7/fOnxwG1r6J8=; b=vhXkYHvQWx5kMzm0TX7fn4o8wcaVfuXlzrkdY950z0c1Mi9/TFZeg1JBviY5XLma2f wIqhrGgpMMY39ouaA+/pxdBiRmodUU6kaedGbjb+Q9ME7cycWQWht9U1q9zY6D/UUu38 99GDBUUw9JFMclBGXHWVepXqU0htQcvMgbDCSDUD6A4c90wOBcBRiY4bnmjVeDvu3yJ4 1H5A0zpBySEC3Sn9HDTYaIpp7wbWxdBbm0v3NVfIycDCoi3syV0E9bWT/dac3xkv2IWM H5Sla+s9hjWvXw3LeJ179Z3SBe2eXcKyCIvq3OwEd4+hq+yqKx/krOwUcmBdhjuKsLq7 eoqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=8AcGMewM; spf=softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.230 as permitted sender) smtp.mailfrom=tobin@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com. [66.111.4.230]) by mx.google.com with ESMTPS id u35si1709638qvg.156.2019.06.02.21.27.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 21:27:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.230 as permitted sender) client-ip=66.111.4.230; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=8AcGMewM; spf=softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.230 as permitted sender) smtp.mailfrom=tobin@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id E7B57123E; Mon, 3 Jun 2019 00:27:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 03 Jun 2019 00:27:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=jGU9saE69a/gfeKWv7WhcnJU8nruwl7/fOnxwG1r6J8=; b=8AcGMewM Ndtg4pdRtsPZpOOKqHUApLCaiiXKUPEyBBAaPdJaaMoZ4+B5eR9/1K70X18Cqxcv UsCHyzJfIMF1H80xNpYpRnilppJPkHuSiN7XKRXkAkLJxGDpxJ5+AxWk/on2Kj1Q 4Dgq5Inh5H9ZWVDSXbCwgyxV1G5i+CbiPvRiY6x/sXaOvU84KptkfhMgi2NnGMi4 7I5PYAJ7yq34ekuIxckmPeilZtbhnrt1WlolEFtEiRgzu/StEyM3hs4sJ0RA0fdX oT2kh8XjDLPSLm/nvFzdE9m/Fj/VLX+MNaxFJHKRQiG3KrYdgq8oL73l0Ab+WN57 LZoMA1Af0XMAwQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudefiedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpedfvfhosghi nhcuvedrucfjrghrughinhhgfdcuoehtohgsihhnsehkvghrnhgvlhdrohhrgheqnecukf hppeduvdegrddugeelrdduudefrdefieenucfrrghrrghmpehmrghilhhfrhhomhepthho sghinheskhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from eros.localdomain (124-149-113-36.dyn.iinet.net.au [124.149.113.36]) by mail.messagingengine.com (Postfix) with ESMTPA id BBC6680059; Mon, 3 Jun 2019 00:27:48 -0400 (EDT) From: "Tobin C. Harding" To: Andrew Morton Cc: "Tobin C. Harding" , Roman Gushchin , Alexander Viro , Christoph Hellwig , Pekka Enberg , David Rientjes , Joonsoo Kim , Christopher Lameter , Miklos Szeredi , Andreas Dilger , Waiman Long , Tycho Andersen , Theodore Ts'o , Andi Kleen , David Chinner , Nick Piggin , Rik van Riel , Hugh Dickins , Jonathan Corbet , Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] slub: Sort slab cache list Date: Mon, 3 Jun 2019 14:26:25 +1000 Message-Id: <20190603042637.2018-4-tobin@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603042637.2018-1-tobin@kernel.org> References: <20190603042637.2018-1-tobin@kernel.org> MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP It is advantageous to have all defragmentable slabs together at the beginning of the list of slabs so that there is no need to scan the complete list. Put defragmentable caches first when adding a slab cache and others last. Signed-off-by: Tobin C. Harding --- mm/slab_common.c | 2 +- mm/slub.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 58251ba63e4a..db5e9a0b1535 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -393,7 +393,7 @@ static struct kmem_cache *create_cache(const char *name, goto out_free_cache; s->refcount = 1; - list_add(&s->list, &slab_caches); + list_add_tail(&s->list, &slab_caches); memcg_link_cache(s); out: if (err) diff --git a/mm/slub.c b/mm/slub.c index 1c380a2bc78a..66d474397c0f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4333,6 +4333,8 @@ void kmem_cache_setup_mobility(struct kmem_cache *s, return; } + mutex_lock(&slab_mutex); + s->isolate = isolate; s->migrate = migrate; @@ -4341,6 +4343,10 @@ void kmem_cache_setup_mobility(struct kmem_cache *s, * to disable fast cmpxchg based processing. */ s->flags &= ~__CMPXCHG_DOUBLE; + + list_move(&s->list, &slab_caches); /* Move to top */ + + mutex_unlock(&slab_mutex); } EXPORT_SYMBOL(kmem_cache_setup_mobility);