From patchwork Fri Jun 29 15:37:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 10496969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5107560325 for ; Fri, 29 Jun 2018 15:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EC8829B68 for ; Fri, 29 Jun 2018 15:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 322B329B61; Fri, 29 Jun 2018 15:39:24 +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, 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 42B8029B61 for ; Fri, 29 Jun 2018 15:39:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 208366B0269; Fri, 29 Jun 2018 11:39:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6A56B026A; Fri, 29 Jun 2018 11:39:22 -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 0311A6B026B; Fri, 29 Jun 2018 11:39:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id B1CE36B0269 for ; Fri, 29 Jun 2018 11:39:21 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id z5-v6so5232692pln.20 for ; Fri, 29 Jun 2018 08:39:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :references:from:openpgp:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PvVJxkSVwiC2r8YIrt2vB33ShnybM9aRxJsSkU9w+tA=; b=fnE1d7ZUg81zAqv0iUgmV9tMO7Ie5t6xIpHscSj1Z6FrHS/6rTRJ6gQa363FjVCBDr 49lEYYzdf9teP6nvCRSwUzeCgH709jf68vuzEtb8DHpYJzGtd/4gpvOfhecWyigN0gLC bzfWayTQDtcdNWT+KlX4gnlp0c1l9ntbHTzlbPbUWexszn5SC/Bm51OysEILAjsLXynI Uxuxvs7k2TauEjhVOK2DWLd9IRs9sDvwKPAXbkOI5fq9Ue8bzNevzoNxaC1lJUuyC1jP RoAyyDrlJe+Nmzsmz2lFLwmE7w9HDY5J9WcwG7VC/TIMVxZku/7cM5pRAdxHXGCccUrE US2A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Gm-Message-State: APt69E1jlj0jc89ECJMZAFnUl8ZApJ7pyr+HE4lKYyuliCRfr7sCKATf DlYqoSN40LscJdbQhnwOq4U5sQCVlKXBV2D6X3TrtoCDDmhC/nrWFbVJGYkIABoIXfHbiY4kaZA zvDvL2sETBu2THwoKhwXJgnlp/pm1UkVB7/eGSQ2LQJKpFl7ApgZl29zaZ3eOE6erDA== X-Received: by 2002:a17:902:26:: with SMTP id 35-v6mr15407113pla.276.1530286761381; Fri, 29 Jun 2018 08:39:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLA5u4RHCV6OOQqIeQs1uPMcK6uBAMO4EYicHdKszSSvTCM0xo3dfX3mxYcsRDA+Y84a2cm X-Received: by 2002:a17:902:26:: with SMTP id 35-v6mr15407058pla.276.1530286760486; Fri, 29 Jun 2018 08:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530286760; cv=none; d=google.com; s=arc-20160816; b=RZgdDExSn9695kntJbsyaj78/M6U8gpfIEFpJqigA4lEeDZn+1Iya5N7Uf3HLPi4jy B1rSmGj27m6HidwiHkqugTGnzvTXZQQVTq1kTmd32JRZ7/lADfbXIUSoi0yOe8yD8Clp IuzqBicaVcMK1SDGYnaDgCaDS+WVbN5kjs8jaEllcjoHhrwLGeP6JUgb3QLhXMLvc/HM cthhibc1xlLizInaXpISbh5HrSyq5nArHQCHpUCvWQhvzmtQvi55Ip28pRsEg6t9dLK9 wlxxQuQv2sDaWTRRyDeEVXNxFZE2H97zTKssUb+tH6f+JVhNPO6HeNOxDrQx9Xoz7rTf jnUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:autocrypt:openpgp:from:references:cc:to :subject:arc-authentication-results; bh=PvVJxkSVwiC2r8YIrt2vB33ShnybM9aRxJsSkU9w+tA=; b=FVtQti/QZvuKcuVR4Zu5Moi2ewfU+AGiu+HlaBnlvBFsQsDR2mhnMSC329pTLOxv2f NM1f/F0XETreaRlJLvJ2ECIaduKsTfu4lqkoB6dkx406FAkOIubwXDNCfsxC21dqaXL2 jMsC1IlLEc9SiogM9FZbTGlgBYkUIPt1Vmp1Xc9BRaLvl5UL5bZUSr7NNdFkX1mE+n0o yWQdcEpiu7vejTw/+3wOclw5d9q/WNc5tVZI877o2UAWdP+6cvarkdcqMAuolaBRD4nW DXiFgMG2dHHZXKrA47WwFdmoiIxEiTOWVVqbsRyPcN3bPr/wePYybn6gvn7DYnXoSABq rQcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id h18-v6si8901104pfn.158.2018.06.29.08.39.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jun 2018 08:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 355BCAED0; Fri, 29 Jun 2018 15:39:18 +0000 (UTC) Subject: Re: [PATCH v2 5/7] mm: rename and change semantics of nr_indirectly_reclaimable_bytes To: kbuild test robot Cc: kbuild-all@01.org, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin , Michal Hocko , Johannes Weiner , linux-api@vger.kernel.org, Christoph Lameter , David Rientjes , Mel Gorman , Matthew Wilcox , Vijayanand Jitta , Laura Abbott , Sumit Semwal References: <20180618091808.4419-6-vbabka@suse.cz> <201806201923.mC5ZpigB%fengguang.wu@intel.com> From: Vlastimil Babka Openpgp: preference=signencrypt Autocrypt: addr=vbabka@suse.cz; prefer-encrypt=mutual; keydata= xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB 87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+ 9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+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MNDEOGD/4sn9OoHxm6J04jLUHFUpFKDcjab4NRNWoHLsuLGjve Gdbr2RKO2oJ5qZj81K7os0/5vTAA4qHDP2EETAQcunTn6aPlkUnJ8aw6I1Rwyg7/XsU7gQHF IM/cUMuWWm7OUUPtJeR8loxZiZciU7SMvN1/B9ycPMFs/A6EEzyG+2zKryWry8k7G/pcPrFx O2PkDPy3YmN1RfpIX2HEmnCEFTTCsKgYORangFu/qOcXvM83N+2viXxG4mjLAMiIml1o2lKV cqmP8roqufIAj+Ohhzs= Message-ID: <38c6a6e1-c5e0-fd7d-4baf-1f0f09be5094@suse.cz> Date: Fri, 29 Jun 2018 17:37:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201806201923.mC5ZpigB%fengguang.wu@intel.com> Content-Language: en-US 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 On 06/20/2018 01:23 PM, kbuild test robot wrote: > Hi Vlastimil, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on mmotm/master] > [also build test ERROR on v4.18-rc1 next-20180619] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Vlastimil-Babka/kmalloc-reclaimable-caches/20180618-172912 > base: git://git.cmpxchg.org/linux-mmotm.git master > config: x86_64-allmodconfig (attached as .config) > compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 > reproduce: > # save the attached .config to linux build tree > make ARCH=x86_64 > > All errors (new ones prefixed by >>): > > drivers/staging//android/ion/ion_page_pool.c: In function 'ion_page_pool_remove': >>> drivers/staging//android/ion/ion_page_pool.c:56:40: error: 'NR_INDIRECTLY_RECLAIMABLE_BYTES' undeclared (first use in this function) > mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/staging//android/ion/ion_page_pool.c:56:40: note: each undeclared identifier is reported only once for each function it appears in > > vim +/NR_INDIRECTLY_RECLAIMABLE_BYTES +56 drivers/staging//android/ion/ion_page_pool.c Looks like I missed a hunk, updated patch below. ----8<---- From a0053c64c72d7e094252d0d7462de8569d87c543 Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Tue, 22 May 2018 16:10:10 +0200 Subject: [PATCH v3 5/7] mm: rename and change semantics of nr_indirectly_reclaimable_bytes The vmstat counter NR_INDIRECTLY_RECLAIMABLE_BYTES was introduced by commit eb59254608bc ("mm: introduce NR_INDIRECTLY_RECLAIMABLE_BYTES") with the goal of accounting objects that can be reclaimed, but cannot be allocated via a SLAB_RECLAIM_ACCOUNT cache. This is now possible via kmalloc() with __GFP_RECLAIMABLE flag, and the dcache external names user is converted. The counter is however still useful for accounting direct page allocations (i.e. not slab) with a shrinker, such as the ION page pool. So keep it, and: - change granularity to pages to be more like other counters; sub-page allocations should be able to use kmalloc - rename the counter to NR_KERNEL_MISC_RECLAIMABLE - expose the counter again in vmstat as "nr_kernel_misc_reclaimable"; we can again remove the check for not printing "hidden" counters Signed-off-by: Vlastimil Babka Cc: Vijayanand Jitta Cc: Laura Abbott Cc: Sumit Semwal --- drivers/staging/android/ion/ion_page_pool.c | 8 ++++---- include/linux/mmzone.h | 2 +- mm/page_alloc.c | 19 +++++++------------ mm/util.c | 3 +-- mm/vmstat.c | 6 +----- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 9bc56eb48d2a..0d2a95957ee8 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -33,8 +33,8 @@ static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page) pool->low_count++; } - mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES, - (1 << (PAGE_SHIFT + pool->order))); + mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE, + 1 << pool->order); mutex_unlock(&pool->mutex); } @@ -53,8 +53,8 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) } list_del(&page->lru); - mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES, - -(1 << (PAGE_SHIFT + pool->order))); + mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE, + -(1 << pool->order)); return page; } diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 32699b2dc52a..c2f6bc4c9e8a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -180,7 +180,7 @@ enum node_stat_item { NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */ NR_DIRTIED, /* page dirtyings since bootup */ NR_WRITTEN, /* page writings since bootup */ - NR_INDIRECTLY_RECLAIMABLE_BYTES, /* measured in bytes */ + NR_KERNEL_MISC_RECLAIMABLE, /* reclaimable non-slab kernel pages */ NR_VM_NODE_STAT_ITEMS }; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1521100f1e63..8ceb45e11b97 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4704,6 +4704,7 @@ long si_mem_available(void) unsigned long pagecache; unsigned long wmark_low = 0; unsigned long pages[NR_LRU_LISTS]; + unsigned long reclaimable; struct zone *zone; int lru; @@ -4729,19 +4730,13 @@ long si_mem_available(void) available += pagecache; /* - * Part of the reclaimable slab consists of items that are in use, - * and cannot be freed. Cap this estimate at the low watermark. + * Part of the reclaimable slab and other kernel memory consists of + * items that are in use, and cannot be freed. Cap this estimate at the + * low watermark. */ - available += global_node_page_state(NR_SLAB_RECLAIMABLE) - - min(global_node_page_state(NR_SLAB_RECLAIMABLE) / 2, - wmark_low); - - /* - * Part of the kernel memory, which can be released under memory - * pressure. - */ - available += global_node_page_state(NR_INDIRECTLY_RECLAIMABLE_BYTES) >> - PAGE_SHIFT; + reclaimable = global_node_page_state(NR_SLAB_RECLAIMABLE) + + global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE); + available += reclaimable - min(reclaimable / 2, wmark_low); if (available < 0) available = 0; diff --git a/mm/util.c b/mm/util.c index 3351659200e6..891f0654e7b5 100644 --- a/mm/util.c +++ b/mm/util.c @@ -675,8 +675,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) * Part of the kernel memory, which can be released * under memory pressure. */ - free += global_node_page_state( - NR_INDIRECTLY_RECLAIMABLE_BYTES) >> PAGE_SHIFT; + free += global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE); /* * Leave reserved pages. The pages are not for anonymous pages. diff --git a/mm/vmstat.c b/mm/vmstat.c index 75eda9c2b260..7c677d3a61ec 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1161,7 +1161,7 @@ const char * const vmstat_text[] = { "nr_vmscan_immediate_reclaim", "nr_dirtied", "nr_written", - "", /* nr_indirectly_reclaimable */ + "nr_kernel_misc_reclaimable", /* enum writeback_stat_item counters */ "nr_dirty_threshold", @@ -1704,10 +1704,6 @@ static int vmstat_show(struct seq_file *m, void *arg) unsigned long *l = arg; unsigned long off = l - (unsigned long *)m->private; - /* Skip hidden vmstat items. */ - if (*vmstat_text[off] == '\0') - return 0; - seq_puts(m, vmstat_text[off]); seq_put_decimal_ull(m, " ", *l); seq_putc(m, '\n');