From patchwork Wed Nov 7 01:31:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10671727 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 315B915A6 for ; Wed, 7 Nov 2018 01:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2145B2B419 for ; Wed, 7 Nov 2018 01:31:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 134C92B430; Wed, 7 Nov 2018 01:31:32 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 A7AE22B419 for ; Wed, 7 Nov 2018 01:31:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B7EA6B04AE; Tue, 6 Nov 2018 20:31:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 068FF6B04AF; Tue, 6 Nov 2018 20:31:30 -0500 (EST) 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 E9BA46B04B0; Tue, 6 Nov 2018 20:31:29 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id AA6736B04AE for ; Tue, 6 Nov 2018 20:31:29 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id 127-v6so12955139pgb.7 for ; Tue, 06 Nov 2018 17:31:29 -0800 (PST) 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; bh=xp8NLPFklFSANRB+JZUXzoFZlok75S3bvys2YX/NOkQ=; b=SL7JSXtzZBxR1JFt1+EGRJwxZH3kjuF75dOkwP5GggOvxs48c6IRcZsrms5LTH5Ppa w2lcms/z4jB3cPedt7B9V7HsDIDGn6+5a565yV495z13/VRKavwcidzvXVyjplFdRtxL cjZ4wETMOHiRoZg85oYeyXplg/aMib3XS6sVn9K0v7O524x7YLaKrdHZ6uyWVK7TrLco HNgWs4hiQan3UBvCkonIORZDJ0DjkV30hSah53txNbzjPZd+YEDwUDBlNhtrIu8Gm8zO FU6tghG4Loh/5zXarepUwlLMqiRbTWyYUvCt/t4QrsFrtyVBUqHNm8mOT/FICDIQG1MI MoIQ== X-Gm-Message-State: AGRZ1gI4sd6eyuJwox2pXSLk1jHqbgrKrdS1snnWW5ioT96IN1F7Lk3j bhbNFkszAIHLI4C5yCFou9VYqS/ERnI7g0Cq66IdIQCtjFZa3r9qbJLX09Pu241X1lLz1xNeQhN MeVp5894+SXGXo3c/bqGLtqhpFpBv+iwOUCIWhai/MpV+6FRaxv0axwB+zH+zhl1WIrfV+DYoA1 LmT+f6QBIZ+duf9bQtFZas8pgwBP31leLiRaI4Knh0SOZj+mBsjY5Omo3OIKQoAG0LCcVWwPPEA SJLPssFSWRmn2Hsx+3VbKtzR6imMLIlFKIKFJjtw8mUI7020AYw0fyYQczJ5ZKsc9uZJxKatuNa 7ij5zpTMUZJeiq+zvySz4XumfRVzMH8DRxcdZfqj5/v/X4DBSC298aJzaAn4NVnu2HTmJoMn05f U X-Received: by 2002:a62:3046:: with SMTP id w67-v6mr28691516pfw.177.1541554289251; Tue, 06 Nov 2018 17:31:29 -0800 (PST) X-Received: by 2002:a62:3046:: with SMTP id w67-v6mr28691481pfw.177.1541554288460; Tue, 06 Nov 2018 17:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541554288; cv=none; d=google.com; s=arc-20160816; b=OweFEq1YFl25a/g/D5f0XDMQ+hjPDsKSxNJRniwqqwaH/kq7DrAYYnw42Gu05RmxLW tlKjMw7ZVi0C+AGqcz4zV3OhdQD8VzFP/xcrXy4/XtA4qysYxe3OT+r4/XK6qJ+5P+GA 6XHM70AXxHiKRqFU6C5ZhrcraehRPE0d5ch/vLuhzvztgnE1adzhO6Y8T7tq4Gmo1jUN g7SVo8591cQAYPku8uGarlK0hW0x2WGTxGOtPCGva5TeoEpMMcEERbJ/U6cS3K84809w GwBdpOt+FwPJaNxs0qibUsKZ84CSPEMNpu2jEk0nLKAWjkyx3DjtaXbqoOVLvvuInAf/ gptA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=xp8NLPFklFSANRB+JZUXzoFZlok75S3bvys2YX/NOkQ=; b=CDEhOpB5U6UquTVohCh6eZELRrBLXWxgwy1OGKdy2n89pahixViwM0jD34rr5Z+CRH 4i0wE+3U+0Wf6ezensizJWSFtFtQAqLu7kgWmKTrkUgez/5Duu6iLEP8pu+ydOHpt6/A 9R9qmCMCUTO8S4TeK1J0DUG6qkHL6e7IcxG9/fS4S8q6MEOmeKD+vZYzRTLvaQkIVdRJ bHn2k01J7134ZhJNxYuF1TWEh559oXXd2+Q+dp0sC2IzheBN/PPmKGfcrZHJZVIfqHIc B4iRSjQIenrztgxpJC1170/GPL4rKPqjhMlCDD7DpvNYX7wZSP2DiuXZI8EiMacyeAn9 +UZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e8NDWOjO; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b17-v6sor46688154pls.11.2018.11.06.17.31.28 for (Google Transport Security); Tue, 06 Nov 2018 17:31:28 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e8NDWOjO; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=xp8NLPFklFSANRB+JZUXzoFZlok75S3bvys2YX/NOkQ=; b=e8NDWOjOmxPOWrR7yLddyXPlFaZbQCV+gzqcFsI6YVMj9I9cvaorIGDuncyVZQz1Xn XVkSUABZOfXH4HmWe1Szu6LTPDagheHZyKF87OTBY3e025shrnb+W/nuMLgS6oHBBzoJ 9RJnybZddrgvXDveYIebsDz8EnK4ihckeQbwl8n8HnykRRT/sILM0dJ/9LXy+Qmg1IiW LV4BP8i1Ud9cIx+lr+lh2FFj5HMehp7VkPRlaZz+t5W55DBznNQVo4nBha7b+CsGuf8c aamLSx7+mvVzUaseOy+aX3AkPglDvlHEFhO4risx/ep3sfTotHTQYeTAkdVayOe7vAq7 Msvg== X-Google-Smtp-Source: AJdET5fSm6R2f6tBmBD/xe0QTjAmbMwyqghNqwJxF4Ir2Ox537ONhetKpPhHL+D0XDGz2CIq/HsTpQ== X-Received: by 2002:a17:902:3341:: with SMTP id a59-v6mr536678plc.220.1541554287617; Tue, 06 Nov 2018 17:31:27 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id m7-v6sm53043717pgq.59.2018.11.06.17.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 17:31:27 -0800 (PST) From: Wei Yang To: cl@linux.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH] mm/slub: record final state of slub action in deactivate_slab() Date: Wed, 7 Nov 2018 09:31:19 +0800 Message-Id: <20181107013119.3816-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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 In case __cmpxchg_double_slab() fails and (l != m), current code records transition states of slub action. This patch update slub action after __cmpxchg_double_slab() succeed to record the final state. Signed-off-by: Wei Yang --- mm/slub.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 44dd1d6cfbc3..cbb1aade7858 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2136,24 +2136,14 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, if (l != m) { if (l == M_PARTIAL) - remove_partial(n, page); - else if (l == M_FULL) - remove_full(s, n, page); - if (m == M_PARTIAL) { - + if (m == M_PARTIAL) add_partial(n, page, tail); - stat(s, tail); - - } else if (m == M_FULL) { - - stat(s, DEACTIVATE_FULL); + else if (m == M_FULL) add_full(s, n, page); - - } } l = m; @@ -2166,7 +2156,11 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, if (lock) spin_unlock(&n->list_lock); - if (m == M_FREE) { + if (m == M_PARTIAL) + stat(s, tail); + else if (m == M_FULL) + stat(s, DEACTIVATE_FULL); + else if (m == M_FREE) { stat(s, DEACTIVATE_EMPTY); discard_slab(s, page); stat(s, FREE_SLAB);