From patchwork Thu Nov 29 23:55:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10705553 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 45A9D14E2 for ; Thu, 29 Nov 2018 23:55:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A03F2F7E4 for ; Thu, 29 Nov 2018 23:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DD862FB39; Thu, 29 Nov 2018 23:55:43 +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 A8B4A2F7E4 for ; Thu, 29 Nov 2018 23:55:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C4EB6B553D; Thu, 29 Nov 2018 18:55:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 872976B553E; Thu, 29 Nov 2018 18:55:41 -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 714D86B553F; Thu, 29 Nov 2018 18:55:41 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 294956B553D for ; Thu, 29 Nov 2018 18:55:41 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id 202so2337766pgb.6 for ; Thu, 29 Nov 2018 15:55:41 -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:in-reply-to:references; bh=pNsUiP+LASYWAD4CducOjiZGmUsJbKCaK1Q7rPyVkNM=; b=FIsycHmw6bw8qyWEOsgHjOEGvKJKog4IGm5dx3CsUdj93S90u0vc2mM9zxNgrHIspr Mb2H+V9F31HffjB2mJ7gm+Z35T21qlhiHecVuP6jX+oEEljG0kMjU2khNpGUxDqBNM+l HhgLlZNbVSOW7SQSjbClnZpkhQF62jlQByeCg8I3EYSuUe1/ZJZFzxJjeNN0i87eMYm3 ar9TDArCDQwILxfeQYKA5nw/OPdSqUg9cS1oOQ4mUWFnI9rpPjgPWe3tDlVcfDAO0cBq 2Y5sU869v43n4kP4EepYKap11VKhv9EXAtL61bVugQ30fp1xak6AUWJXlMHGpw8jMqSF lBfA== X-Gm-Message-State: AA+aEWZt5txM2pzCm0PYkbPhpuP2+0dPAlfHetezRfmDv3SKtpYak9HD sxqP6xBbNqSZ7pWNz5+sNDRw6zclid3rtFJHoNhS/45UWoDQPkCk0vJWxmt35gMfMWMWfICiYQI dnTpZiHh9NjNeSmlya10G/PWsSIxlnifw9+lChRGzkaMBaqgWJVdX3Mx9/7jFTdQgZYTz1fkjS8 NX32zDtKkDHCJY8uuR2FJl7ebA4UBvvQlrbgsrq3ktD5Rm8aWJWv+LNOWRf3LZ9sJsTYQA+QXVl GnBTpWC91bSljPA88WXdAK0zRBqo68QHabQ/W0emjAm5avwiXXkWMDcEMPbL0tSxtQLhGsjbSdK my91bHnBohFhhVXtyebOwcL8ZmH3o23rs7Als4JN7+lGy/uCDUEdOWlbA+N6Xnc6VPWAC+B0J9y / X-Received: by 2002:a62:47d9:: with SMTP id p86mr3345715pfi.95.1543535740775; Thu, 29 Nov 2018 15:55:40 -0800 (PST) X-Received: by 2002:a62:47d9:: with SMTP id p86mr3345679pfi.95.1543535740091; Thu, 29 Nov 2018 15:55:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543535740; cv=none; d=google.com; s=arc-20160816; b=IEZvNM1/vXVbqBcejGfsytJEGpbFIpS9zZth2CXU57hHKVjS3EaIFlulw8oRHUPzoT +KgJZlx+b2m+YI6w+6nL6T4rXb5u903dYU+zImNaI+53Nn4ktWZRniHpi5Om0kAX1wHK oO0qSVQ6Jiot5YoMoY6MjaeSSSZYLdqgrVOSQ2aUJ7q5sDsKd7L3j8I2wI6rB+0pjLON Sx1JaHbhUIsmNqBxbRopG/YazYxYNQLHh8pKrqeOjv+aM1hf+FeAIFLfvtvpyduInJdV 2BsVbuaXDLk9P/rNECiWyBKdg3t5YZ18LtSWmJ0ox/MUkCcGCqRI//bRfVxsRRr4wZdS 57xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pNsUiP+LASYWAD4CducOjiZGmUsJbKCaK1Q7rPyVkNM=; b=Mvffz4fEKU3f6K/eVajJK587fn+xsN4F7HnJsvUTGBq6F2akV7hSmRBdDWyDkzBG5X nidwu/GdYAf4ewlgNgkQB/bWBKWtvt0xZ93yhhONVTeD/mOCrHnYCJiOxakAeHJGC386 kZICMOlld3PlbuK9P4kr/uTZNAKIghDnm1BAemLHReRXUXiF3ryOZvNnBAWK25gmIEpz vkuOWCPdwKEDETXoPkO4298cNRJkmAicGjxKS7wAS5c3PF7rdwtUTpxo2DY4MX9PZuBe zCMj4p0g6AEjwT5YBYRVUb18tJOgqbKrtzQIPsaXZkBgRmOJj8EFQpBf5eT++OnfF+j6 dqaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=llJVXbTP; 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 v12sor4859642pfd.68.2018.11.29.15.55.39 for (Google Transport Security); Thu, 29 Nov 2018 15:55:40 -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=llJVXbTP; 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:in-reply-to:references; bh=pNsUiP+LASYWAD4CducOjiZGmUsJbKCaK1Q7rPyVkNM=; b=llJVXbTPBGGzY8/g7NMiELLXo+0SNOzbwCmL1gyi7FLuEhop7s7ymufwh//n4+Uf5n bkbQPp3lIjfGP+KgSNsb4+PwNxK9fmyumGcJ9Rti5K3DBAlFxZCLTYbO9uMwbLPOqUvU SVyepZXEbZZ+bzhO+tmIctSOUuoUAxu9TOcU9KqxU3CO3y5a1gxgFtij/whrIweL/QdW gLOzD5k50ELFi//GauMtXdpWnia0cJqVzAMQewrbi+luSdvWKtJHRpIwXIW7Lh7CMlbR 5w3pmCuDu27SEwb+DQy0Octqg5r4pLjGc27CgKgsgHdr/HWE7EM/hc1vigR1oHdhUbBa f1pQ== X-Google-Smtp-Source: AFSGD/Ust2b5Gqj5DJRsr8llnkkx51UAEX0XgwY+0NjWoXA1OYpAqVscheBrODd3nDZgGWfCew02KA== X-Received: by 2002:a62:4bcf:: with SMTP id d76mr3609038pfj.170.1543535739763; Thu, 29 Nov 2018 15:55:39 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id w184sm3626187pgd.34.2018.11.29.15.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 15:55:39 -0800 (PST) From: Wei Yang To: mhocko@suse.com, akpm@linux-foundation.org, jweiner@fb.com Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH v2] mm, show_mem: drop pgdat_resize_lock in show_mem() Date: Fri, 30 Nov 2018 07:55:32 +0800 Message-Id: <20181129235532.9328-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20181128210815.2134-1-richard.weiyang@gmail.com> References: <20181128210815.2134-1-richard.weiyang@gmail.com> 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 Function show_mem() is used to print system memory status when user requires or fail to allocate memory. Generally, this is a best effort information so any races with memory hotplug (or very theoretically an early initialization) should be tolerable and the worst that could happen is to print an imprecise node state. Drop the resize lock because this is the only place which might hold the lock from the interrupt context and so all other callers might use a simple spinlock. Even though this doesn't solve any real issue it makes the code easier to follow and tiny more effective. Signed-off-by: Wei Yang Acked-by: Michal Hocko Reviewed-by: Oscar Salvador --- v2: * adjust the changelog to show the reason of this change * remove unused variable flags --- lib/show_mem.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/show_mem.c b/lib/show_mem.c index 0beaa1d899aa..f4e029e1ddec 100644 --- a/lib/show_mem.c +++ b/lib/show_mem.c @@ -18,10 +18,8 @@ void show_mem(unsigned int filter, nodemask_t *nodemask) show_free_areas(filter, nodemask); for_each_online_pgdat(pgdat) { - unsigned long flags; int zoneid; - pgdat_resize_lock(pgdat, &flags); for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) { struct zone *zone = &pgdat->node_zones[zoneid]; if (!populated_zone(zone)) @@ -33,7 +31,6 @@ void show_mem(unsigned int filter, nodemask_t *nodemask) if (is_highmem_idx(zoneid)) highmem += zone->present_pages; } - pgdat_resize_unlock(pgdat, &flags); } printk("%lu pages RAM\n", total);