Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1657595ybe; Wed, 11 Sep 2019 19:35:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwUdrMfwU915qTdYwoFjx7/FxujglEOXiRAZTNJCeB1+fioUvV+DH5GfOCTEzYGwWmL1do X-Received: by 2002:a17:906:4d82:: with SMTP id s2mr31980240eju.94.1568255722011; Wed, 11 Sep 2019 19:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568255722; cv=none; d=google.com; s=arc-20160816; b=PXn/A89ofXRG2qwLjENjCLhmrW3QXbZdZODa9XipVgZLAYxFD2/z2flK++maVqxTTB c+yGtv6ItTEg53mYrxA2QHSQq3SdnKImiOcQP7GtqFyN5Qkio7AmtOgjgIktgmJQT02J FrVyXLuaqyVC6ZLcp4Bhp++PJ0V2Y2XAjxjarzAmGY+QgELp1L8T/7CJzck//V36xAkR YinysjUfctWr8Bz1TvQIJYsk9352Vt+sN+HDaP+LbS+mkb2PNe4wDXN3egvp5aR07Ydi Bky+vFYsEeuSOZogyDA904tUSwEG4iNj+PNLihT9vhAJYXkAi0eI1iYOPuwkdUjVPRZB omZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=VTFLG8eFeKeX5rA9A/RF+SH0kKZbbcZcTGiLOknhM8o=; b=ppW0EdOYKf1fr8X2JTLjG3kCoYwLvLRsS6aEc/eQ2fsU6F+IDtqINMyT96ZrKVzCjb D/kI40H5HaHwDPVMWTm0/Ywn9m1wvlFfCkfij2VFojEd2jl/ZjDElzlaX2khjbUf6+H/ gq75dtsabwUSt9uCTq3M0z82baR4rKA2GbZOO9JXutm5384faqxUg0mZLYd5ojnSFDzC j3ueN28bbqq1QL+5LRBHyXWML1I9Qlgo7To49S4JJccSjBa03K8alNjn2+glUWi/FYFq XlySA4AlP/XcrEnAPD7LzTmjjI787RtuBiG1UTyVIPSCrgFmPiTJ/VueF7ZxAlK01A9O Da4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mJDejJWU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rv26si12168920ejb.354.2019.09.11.19.34.58; Wed, 11 Sep 2019 19:35:21 -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=@google.com header.s=20161025 header.b=mJDejJWU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729066AbfILCbV (ORCPT + 99 others); Wed, 11 Sep 2019 22:31:21 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:44685 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbfILCbU (ORCPT ); Wed, 11 Sep 2019 22:31:20 -0400 Received: by mail-yw1-f73.google.com with SMTP id n3so19677594ywh.11 for ; Wed, 11 Sep 2019 19:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=VTFLG8eFeKeX5rA9A/RF+SH0kKZbbcZcTGiLOknhM8o=; b=mJDejJWULbF2e6+PZwAkN+YGqXTd60leJIfoP5qWwNzJgFkWguAYWTXbJHoH179vfN MNo0gETMkGUgE9ahWgfnQnCguxv1zyWyfPQ2DrDntXMldyLa/Eo2kA3/Uq3jteAPcB55 nTHNFlL0yZ/2vjoKxpDKIwjz1eYcjWO8Lf3MSwzODBLqcW4yQhjRRDjxezY2S4aWPYGy xHY7O/sD6nsAljyk2+jSMl+/UwCn8y3E9kB9WBwDIk9tP0gLmlthNDbAH9+ML/wDsIgQ EidIO4tIrVes2jrRn+rlnMICcIwA3NOOhfV+FnqdnFh1yhMGwgu7Mfk8vPa0cj1OJJTB AYhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=VTFLG8eFeKeX5rA9A/RF+SH0kKZbbcZcTGiLOknhM8o=; b=ohD0vOpzok7rmiyTL7W0urhZ1a7ocofcUZ0foyOu0rD7UaRgaf1ZbyUu9G3YB+Zppn eOG2ICYeT2P+DQmgMJeApIxEl3r9AhdQL3QJQ0pKbc8mN/XC1AoaK+0ziDYlD4xfgjTd OYFBFcQjFw/tZ99PlMPgK9cFLO8eAtaiDWFHp0+5FPSgneD3RGZD33YSrIKZaMWUERQx Xamw4B0HQIsd5lWDMc0wHjNTaw9AkDGM0vwuHdmlbIlBp11e5m3FckTq0oSTiKpfO0b/ w7129pj1aOV0LkP+qbmo0iXRrmPJd6wWm+HMR7V3Us+HWspIrk4JbAtOQJFCG6EPxbok /7gA== X-Gm-Message-State: APjAAAUQqVlPKI7So4/Rpm1tBMuYUkD1KZVAg8RFRgmYlOMhGxi/mMfV FhMr/dikpa0kHrGdUViWRsHQ/iRjVRg= X-Received: by 2002:a81:4e8d:: with SMTP id c135mr28278227ywb.149.1568255478967; Wed, 11 Sep 2019 19:31:18 -0700 (PDT) Date: Wed, 11 Sep 2019 20:31:11 -0600 In-Reply-To: <20190912023111.219636-1-yuzhao@google.com> Message-Id: <20190912023111.219636-4-yuzhao@google.com> Mime-Version: 1.0 References: <20190912004401.jdemtajrspetk3fh@box> <20190912023111.219636-1-yuzhao@google.com> X-Mailer: git-send-email 2.23.0.162.g0b9fbb3734-goog Subject: [PATCH v2 4/4] mm: lock slub page when listing objects From: Yu Zhao To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , "Kirill A . Shutemov" , Tetsuo Handa Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Though I have no idea what the side effect of such race would be, apparently we want to prevent the free list from being changed while debugging the objects. Signed-off-by: Yu Zhao --- mm/slub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index baa60dd73942..1c9726c28f0b 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4608,11 +4608,15 @@ static void process_slab(struct loc_track *t, struct kmem_cache *s, void *p; unsigned long *map; + slab_lock(page); + map = get_map(s, page); for_each_object(p, s, addr, page->objects) if (!test_bit(slab_index(p, s, addr), map)) add_location(t, s, get_track(s, p, alloc)); put_map(map); + + slab_unlock(page); } static int list_locations(struct kmem_cache *s, char *buf, -- 2.23.0.162.g0b9fbb3734-goog