Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3689242imm; Mon, 18 Jun 2018 02:20:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJYsn66z+LK40y1KamVtUPLP/uRXh6aF1ECmctzdbqTAVTxhlS3yWXAFeSRhCkMgBysvFIh X-Received: by 2002:a65:4b82:: with SMTP id t2-v6mr10029703pgq.175.1529313613884; Mon, 18 Jun 2018 02:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529313613; cv=none; d=google.com; s=arc-20160816; b=mWa6r61SVShMaGbSXjouaUNxjcxMJkA9suQQXWO6q9knx6uZu36DPSW9WfE5nrW2i/ g2r6KeYbY9pRSWsvEFpjWvfLVgvas8nqptWxSP/967wfCmFL2xCwSmu92vhYO2RqvM6D CKo00rSxIJ7RpbYCb0BxhTTwpl1+R6qdIPK2KIdI/VvhT3EuF/pgH+0y6FoDkFKYfG6U py8RSCv37NyIFsvYDw/oK1pz7aKSXT/7V2O5Am3z15bc50cXFXZbFrZa55XXzA26U0X0 Yv/EuGAgQuSbTzhWAlY/8Zskn6hEerF33U0FbHc0fz1dMfnWL++m9TAEzNPreryC5UkE Opag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bqblh5bGsEgpsGRXzQhZJ3oLIA6Jr9oA5/MQPYW5rcA=; b=BRgqfEaVEUEJ8zx+UnC2a/zLAdyTvZbboFaabS8RPvi/+MBqAy77U5NQRUV5G+33F4 LiBM5fhiqtQiLYDLENnWLCyToCg/egtzTzKiXFtl4UG1rS13pqwJdlD3aLOKkL6eFmHz SftyDdTEXd+wE7Xv6CMIA3slfq9PH7971LsagWRTc+K2GB2LSQmGmj72qJyrZUbcgQdo b9zS37V/BfkJ2oEZaKcNTYcREG40UtapH7LdPZhoSEjGakZ4D73+NkKqtxlGT6WVavCC zgTZ3EirAuyOpz0sfLN9JG4oFucFrLpCvMTrYtfu8h1JFj0UPyOkTr4574L1sHiLPpsH JxRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si15532071plk.111.2018.06.18.02.19.58; Mon, 18 Jun 2018 02:20:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966870AbeFRJSe (ORCPT + 99 others); Mon, 18 Jun 2018 05:18:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:38580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966624AbeFRJSc (ORCPT ); Mon, 18 Jun 2018 05:18:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DEF0EADCA; Mon, 18 Jun 2018 09:18:27 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: 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 , Vlastimil Babka , Vijayanand Jitta , Laura Abbott , Sumit Semwal Subject: [PATCH v2 5/7] mm: rename and change semantics of nr_indirectly_reclaimable_bytes Date: Mon, 18 Jun 2018 11:18:06 +0200 Message-Id: <20180618091808.4419-6-vbabka@suse.cz> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618091808.4419-1-vbabka@suse.cz> References: <20180618091808.4419-1-vbabka@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 4 ++-- include/linux/mmzone.h | 2 +- mm/page_alloc.c | 19 +++++++------------ mm/util.c | 3 +-- mm/vmstat.c | 6 +----- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 9bc56eb48d2a..b7ad2d2449ac 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); } 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'); -- 2.17.1