From patchwork Thu Mar 14 05:31:28 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: 10852159 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 CFE081575 for ; Thu, 14 Mar 2019 05:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B44342A187 for ; Thu, 14 Mar 2019 05:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A87FD2A19B; Thu, 14 Mar 2019 05:32:11 +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 25A362A198 for ; Thu, 14 Mar 2019 05:32:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B2428E0003; Thu, 14 Mar 2019 01:32:09 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 93A248E0001; Thu, 14 Mar 2019 01:32:09 -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 802558E0003; Thu, 14 Mar 2019 01:32:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by kanga.kvack.org (Postfix) with ESMTP id 538758E0001 for ; Thu, 14 Mar 2019 01:32:09 -0400 (EDT) Received: by mail-qt1-f197.google.com with SMTP id i21so4300776qtq.6 for ; Wed, 13 Mar 2019 22:32:09 -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:mime-version:content-transfer-encoding; bh=0As+3Iv3Sxmfep8uKsH5/xjkJPw9kSFzNL2pVLlfV7o=; b=YGpQZxFXtNS7ihpqQP44kTlfR4Y4ZILqJ4kKA/1fdsCwSKod7idx5SMkfgsaTudZLU Aa2yfb5fTiPphK/5dKh9RavC0No1I34uRNh+gj+w6gFeijfrhX1Elo8QsoucFPHHOdXv 9ICrCLtpxEulGXM9vJemTtsQ/Xy2vdNJe5BrzV7fCYIgnd4Czu/e4xwLfhoRFdYXyxQ1 zTjQHl8/3dDhPRs35iwjBG0GqeZp4Bhd6FLjMp0eKV7nOjeoEIUhgumQO7n8wwF3r8oX bEgDrsBLSsCNoelwSZCmUDEklTiIaE3QjVih/b4ck7RaJ26Bx8gfQbY1CzxTpZPqIxnx z1nA== X-Gm-Message-State: APjAAAXOJ2dpu1LnwyKYncvbNqU77u499e4KvuWqMH6X25zwtb+C0x8D UjYAU6abz/VM61bNuyXVyLodZjH5CP8ZY73g8b5PFjSoBWxBIWNN2+c5j4KhBdJfBReledr8u1/ qWJp2jW+XaFfAdfRd7c3147qMxvHVYrOMr7lfvRqfbLV03r/r8fmg5Ur0lgRZ3Tc= X-Received: by 2002:ac8:96c:: with SMTP id z41mr36908117qth.305.1552541529058; Wed, 13 Mar 2019 22:32:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTZTnWzq2VF3oSXEOY0wWmdQ48MS0iFAecC7BGG2kKj6Tl5UajGGqdZFKi1IbM1I57YkHV X-Received: by 2002:ac8:96c:: with SMTP id z41mr36908076qth.305.1552541528062; Wed, 13 Mar 2019 22:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552541528; cv=none; d=google.com; s=arc-20160816; b=zeBKSbjQVThYbE/2jPcvHDFH4nszDTimGJPXtwZeKBu+ZaHF2NuoGQm0S05e6YNsdf +qmzj7TliuHCQa8SQLPjk29XoAbkew20TcUOFKFfN4fMfGhvmGslCay83rbuVDoYGwHn 6wGPMP1EEPBnTaUHiNMXhn99cM3ecXBowKc/UxUvhjO6My6sh2zuq8M8P3hAOwbSF7+W m+OzxmWc/+lfitmKyQM2rjt0XpHnmerW2uBGIAooeUSEZfvHpabcuUQDcu7EOJ4LzOkL 0KeYWOeFJrj9XKj8OwpPB91qOtUCxVmjkA5B5xXfJfreo3b4ywghTvfl9ZbomgVQe9uA +qiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=0As+3Iv3Sxmfep8uKsH5/xjkJPw9kSFzNL2pVLlfV7o=; b=cE0kt2p3CK1TmysT6oylNOZPImgJJfeHqMgkUtkPkNaR01mLapqRgfjkJnu9eKxOUV AhcMLroj0ccZh+6llkfBFzohLI+hhTixAtbMnHhSox6l4Ccx7UZo3DI2dukRqRgbrQZW hw2eoNkYgHZInMiGGu0nOzrEd939ANez9hA2x86jIGG35wO/N0tEaaS2VxQr98TEam3b 3gOyWD4qIcwWeDvjifw580wa3w1Rf1zg2OV9qHXNztlHi2nLp/yFpTxiqPzaqYY0XkJX mNsK8wePGcDLm/Um2v8h0ipl5HBw22bmomIRT5dk5x0TLftiyeN4JhHXKEDyzn9vCEhN YXNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=nXFyTnSv; spf=softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.26 as permitted sender) smtp.mailfrom=tobin@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com. [66.111.4.26]) by mx.google.com with ESMTPS id k46si1208609qvf.84.2019.03.13.22.32.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 22:32:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.26 as permitted sender) client-ip=66.111.4.26; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=nXFyTnSv; spf=softfail (google.com: domain of transitioning tobin@kernel.org does not designate 66.111.4.26 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 mailout.nyi.internal (Postfix) with ESMTP id A6DAC213BD; Thu, 14 Mar 2019 01:32:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 14 Mar 2019 01:32:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=0As+3Iv3Sxmfep8uK sH5/xjkJPw9kSFzNL2pVLlfV7o=; b=nXFyTnSvQ0TXZ5esZxcjU2Z6vcxxfwqmZ e4QC8rQzhDCWT/uGYUgxLo6y3GTtFjjfIX6REQiGEwetHoG7K6qpJy1yQZhimGet mZO2iZOBRIS+PPIJRbT3m6YK8hFi+CJpaeUcylBhAwk/6rnso8WU1BItuOQ1e6O+ 9u+TU1WG8GYWePLEVSkHO0yaPn+ZThhTTymCL4XaNdJPXo2c+aJbV4oga2ob1U2q SfDI7JCRjkWv5mITQHY1+6r4543vxEfIpu9ezTDGcqISFFP3sAHfTjkNsSNqFwZG Yx3+KWjweqOMK4G+cfiRZnG+1+xrV0/SG013bqPbQuMtUVk0sRYrQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrhedugdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepfdfvohgsihhnucev rdcujfgrrhguihhnghdfuceothhosghinheskhgvrhhnvghlrdhorhhgqeenucffohhmrg hinhepghhithhhuhgsrdgtohhmnecukfhppeduvdegrdduieelrddvfedrudekgeenucfr rghrrghmpehmrghilhhfrhhomhepthhosghinheskhgvrhhnvghlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: Received: from eros.localdomain (124-169-23-184.dyn.iinet.net.au [124.169.23.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 811BCE415C; Thu, 14 Mar 2019 01:32:00 -0400 (EDT) From: "Tobin C. Harding" To: Andrew Morton Cc: "Tobin C. Harding" , Roman Gushchin , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/7] mm: Use slab_list list_head instead of lru Date: Thu, 14 Mar 2019 16:31:28 +1100 Message-Id: <20190314053135.1541-1-tobin@kernel.org> X-Mailer: git-send-email 2.21.0 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 Currently the slab allocators (ab)use the struct page 'lru' list_head. We have a list head for slab allocators to use, 'slab_list'. During v2 it was noted by Christoph that the SLOB allocator was reaching into a list_head, this version adds 2 patches to the front of the set to fix that. Clean up all three allocators by using the 'slab_list' list_head instead of overloading the 'lru' list_head. Patch 1 - Adds a function to rotate a list to a specified entry. Patch 2 - Removes the code that reaches into list_head and instead uses the list_head API including the newly defined function. Patches 3-7 are unchanged from v3 Patch 3 (v2: patch 4) - Changes the SLOB allocator to use slab_list instead of lru. Patch 4 (v2: patch 1) - Makes no code changes, adds comments to #endif statements. Patch 5 (v2: patch 2) - Use slab_list instead of lru for SLUB allocator. Patch 6 (v2: patch 3) - Use slab_list instead of lru for SLAB allocator. Patch 7 (v2: patch 5) - Removes the now stale comment in the page struct definition. During v2 development patches were checked to see if the object file before and after was identical. Clearly this will no longer be possible for mm/slob.o, however this work is still of use to validate the change from lru -> slab_list. Patch 1 was tested with a module (creates and populates a list then calls list_rotate_to_front() and verifies new order): https://github.com/tcharding/ktest/tree/master/list_head Patch 2 was tested with another module that does some basic slab allocation and freeing to a newly created slab cache: https://github.com/tcharding/ktest/tree/master/slab Tested on a kernel with this in the config: CONFIG_SLOB=y CONFIG_SLAB_MERGE_DEFAULT=y Changes since v2: - Add list_rotate_to_front(). - Fix slob to use list_head API. - Re-order patches to put the list.h changes up front. - Add acks from Christoph. Changes since v1: - Verify object files are the same before and after the patch set is applied (suggested by Matthew). - Add extra explanation to the commit logs explaining why these changes are safe to make (suggested by Roman). - Remove stale comment (thanks Willy). thanks, Tobin. Tobin C. Harding (7): list: Add function list_rotate_to_front() slob: Respect list_head abstraction layer slob: Use slab_list instead of lru slub: Add comments to endif pre-processor macros slub: Use slab_list instead of lru slab: Use slab_list instead of lru mm: Remove stale comment from page struct include/linux/list.h | 18 ++++++++++++ include/linux/mm_types.h | 2 +- mm/slab.c | 49 ++++++++++++++++---------------- mm/slob.c | 32 +++++++++++++-------- mm/slub.c | 60 ++++++++++++++++++++-------------------- 5 files changed, 94 insertions(+), 67 deletions(-)