All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] mm/memcg: Address PREEMPT_RT problems instead of disabling it.
@ 2022-02-11 22:35 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 33+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 22:35 UTC (permalink / raw)
  To: cgroups, linux-mm
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Michal Koutný,
	Peter Zijlstra, Thomas Gleixner, Vladimir Davydov, Waiman Long

Hi,

this series aims to address the memcg related problem on PREEMPT_RT.

I tested them on CONFIG_PREEMPT and CONFIG_PREEMPT_RT with the
tools/testing/selftests/cgroup/* tests and I haven't observed any
regressions (other than the lockdep report that is already there).

Changes since v1:
- Made a full patch from Michal Hocko's diff to disable the from-IRQ vs
  from-task optimisation

- Disabling threshold event handlers is using now IS_ENABLED(PREEMPT_RT)
  instead of #ifdef. The outcome is the same but there is no need to
  shuffle the code around.

v1: https://lore.kernel.org/all/20220125164337.2071854-1-bigeasy@linutronix.de/

Changes since the RFC:
- cgroup.event_control / memory.soft_limit_in_bytes is disabled on
  PREEMPT_RT. It is a deprecated v1 feature. Fixing the signal path is
  not worth it.

- The updates to per-CPU counters are usually synchronised by disabling
  interrupts. There are a few spots where assumption about disabled
  interrupts are not true on PREEMPT_RT and therefore preemption is
  disabled. This is okay since the counter are never written from
  in_irq() context.

RFC: https://lore.kernel.org/all/20211222114111.2206248-1-bigeasy@linutronix.de/

Sebastian




^ permalink raw reply	[flat|nested] 33+ messages in thread
* Re: [PATCH v2 1/4] mm/memcg: Revert ("mm/memcg: optimize user context object stock access")
@ 2022-02-12 10:39 kernel test robot
  0 siblings, 0 replies; 33+ messages in thread
From: kernel test robot @ 2022-02-12 10:39 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6849 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220211223537.2175879-2-bigeasy@linutronix.de>
References: <20220211223537.2175879-2-bigeasy@linutronix.de>
TO: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
TO: cgroups(a)vger.kernel.org
TO: linux-mm(a)kvack.org
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: Johannes Weiner <hannes@cmpxchg.org>
CC: Michal Hocko <mhocko@kernel.org>
CC: "Michal Koutný" <mkoutny@suse.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Vladimir Davydov <vdavydov.dev@gmail.com>
CC: Waiman Long <longman@redhat.com>
CC: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Hi Sebastian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.17-rc3]
[also build test WARNING on next-20220211]
[cannot apply to hnaz-mm/master tj-cgroup/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/mm-memcg-Address-PREEMPT_RT-problems-instead-of-disabling-it/20220212-063701
base:    dfd42facf1e4ada021b939b4e19c935dcdd55566
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: arc-randconfig-m031-20220211 (https://download.01.org/0day-ci/archive/20220212/202202121755.VaCaguQX-lkp(a)intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
mm/memcontrol.c:6826 uncharge_folio() error: uninitialized symbol 'objcg'.

Old smatch warnings:
arch/arc/include/asm/thread_info.h:65 current_thread_info() error: uninitialized symbol 'sp'.

vim +/objcg +6826 mm/memcontrol.c

747db954cab64c Johannes Weiner         2014-08-08  6779  
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6780) static void uncharge_folio(struct folio *folio, struct uncharge_gather *ug)
747db954cab64c Johannes Weiner         2014-08-08  6781  {
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6782) 	long nr_pages;
b4e0b68fbd9d1f Muchun Song             2021-04-29  6783  	struct mem_cgroup *memcg;
b4e0b68fbd9d1f Muchun Song             2021-04-29  6784  	struct obj_cgroup *objcg;
9f762dbe19b9f1 Johannes Weiner         2020-06-03  6785  
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6786) 	VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
747db954cab64c Johannes Weiner         2014-08-08  6787  
747db954cab64c Johannes Weiner         2014-08-08  6788  	/*
747db954cab64c Johannes Weiner         2014-08-08  6789  	 * Nobody should be changing or seriously looking at
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6790) 	 * folio memcg or objcg at this point, we have fully
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6791) 	 * exclusive access to the folio.
747db954cab64c Johannes Weiner         2014-08-08  6792  	 */
a6062be9ef6494 Michal Hocko            2022-02-11  6793  	if (folio_memcg_kmem(folio)) {
1b7e4464d43a48 Matthew Wilcox (Oracle  2021-06-28  6794) 		objcg = __folio_objcg(folio);
b4e0b68fbd9d1f Muchun Song             2021-04-29  6795  		/*
b4e0b68fbd9d1f Muchun Song             2021-04-29  6796  		 * This get matches the put at the end of the function and
b4e0b68fbd9d1f Muchun Song             2021-04-29  6797  		 * kmem pages do not hold memcg references anymore.
b4e0b68fbd9d1f Muchun Song             2021-04-29  6798  		 */
b4e0b68fbd9d1f Muchun Song             2021-04-29  6799  		memcg = get_mem_cgroup_from_objcg(objcg);
b4e0b68fbd9d1f Muchun Song             2021-04-29  6800  	} else {
1b7e4464d43a48 Matthew Wilcox (Oracle  2021-06-28  6801) 		memcg = __folio_memcg(folio);
b4e0b68fbd9d1f Muchun Song             2021-04-29  6802  	}
b4e0b68fbd9d1f Muchun Song             2021-04-29  6803  
b4e0b68fbd9d1f Muchun Song             2021-04-29  6804  	if (!memcg)
b4e0b68fbd9d1f Muchun Song             2021-04-29  6805  		return;
747db954cab64c Johannes Weiner         2014-08-08  6806  
b4e0b68fbd9d1f Muchun Song             2021-04-29  6807  	if (ug->memcg != memcg) {
a9d5adeeb4b2c7 Jérôme Glisse           2017-09-08  6808  		if (ug->memcg) {
a9d5adeeb4b2c7 Jérôme Glisse           2017-09-08  6809  			uncharge_batch(ug);
a9d5adeeb4b2c7 Jérôme Glisse           2017-09-08  6810  			uncharge_gather_clear(ug);
747db954cab64c Johannes Weiner         2014-08-08  6811  		}
b4e0b68fbd9d1f Muchun Song             2021-04-29  6812  		ug->memcg = memcg;
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6813) 		ug->nid = folio_nid(folio);
f1796544a0ca0f Michal Hocko            2020-09-04  6814  
f1796544a0ca0f Michal Hocko            2020-09-04  6815  		/* pairs with css_put in uncharge_batch */
b4e0b68fbd9d1f Muchun Song             2021-04-29  6816  		css_get(&memcg->css);
747db954cab64c Johannes Weiner         2014-08-08  6817  	}
747db954cab64c Johannes Weiner         2014-08-08  6818  
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6819) 	nr_pages = folio_nr_pages(folio);
9f762dbe19b9f1 Johannes Weiner         2020-06-03  6820  
a6062be9ef6494 Michal Hocko            2022-02-11  6821  	if (folio_memcg_kmem(folio)) {
b4e0b68fbd9d1f Muchun Song             2021-04-29  6822  		ug->nr_memory += nr_pages;
9f762dbe19b9f1 Johannes Weiner         2020-06-03  6823  		ug->nr_kmem += nr_pages;
b4e0b68fbd9d1f Muchun Song             2021-04-29  6824  
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6825) 		folio->memcg_data = 0;
b4e0b68fbd9d1f Muchun Song             2021-04-29 @6826  		obj_cgroup_put(objcg);
b4e0b68fbd9d1f Muchun Song             2021-04-29  6827  	} else {
b4e0b68fbd9d1f Muchun Song             2021-04-29  6828  		/* LRU pages aren't accounted at the root level */
b4e0b68fbd9d1f Muchun Song             2021-04-29  6829  		if (!mem_cgroup_is_root(memcg))
b4e0b68fbd9d1f Muchun Song             2021-04-29  6830  			ug->nr_memory += nr_pages;
18b2db3b038522 Roman Gushchin          2020-12-01  6831  		ug->pgpgout++;
747db954cab64c Johannes Weiner         2014-08-08  6832  
c4ed6ebfcb0929 Matthew Wilcox (Oracle  2021-06-29  6833) 		folio->memcg_data = 0;
b4e0b68fbd9d1f Muchun Song             2021-04-29  6834  	}
b4e0b68fbd9d1f Muchun Song             2021-04-29  6835  
b4e0b68fbd9d1f Muchun Song             2021-04-29  6836  	css_put(&memcg->css);
a9d5adeeb4b2c7 Jérôme Glisse           2017-09-08  6837  }
a9d5adeeb4b2c7 Jérôme Glisse           2017-09-08  6838  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2022-02-17  9:29 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 22:35 [PATCH v2 0/4] mm/memcg: Address PREEMPT_RT problems instead of disabling it Sebastian Andrzej Siewior
2022-02-11 22:35 ` Sebastian Andrzej Siewior
2022-02-11 22:35 ` [PATCH v2 1/4] mm/memcg: Revert ("mm/memcg: optimize user context object stock access") Sebastian Andrzej Siewior
2022-02-11 22:35   ` Sebastian Andrzej Siewior
2022-02-14 16:23   ` Johannes Weiner
2022-02-14 16:23     ` Johannes Weiner
2022-02-14 19:45   ` Roman Gushchin
2022-02-14 19:45     ` Roman Gushchin
2022-02-11 22:35 ` [PATCH v2 2/4] mm/memcg: Disable threshold event handlers on PREEMPT_RT Sebastian Andrzej Siewior
2022-02-11 22:35   ` Sebastian Andrzej Siewior
2022-02-14 16:23   ` Johannes Weiner
2022-02-14 16:23     ` Johannes Weiner
2022-02-14 19:46   ` Roman Gushchin
2022-02-14 19:46     ` Roman Gushchin
2022-02-11 22:35 ` [PATCH v2 3/4] mm/memcg: Protect per-CPU counter by disabling preemption on PREEMPT_RT where needed Sebastian Andrzej Siewior
2022-02-11 22:35   ` Sebastian Andrzej Siewior
2022-02-14 16:46   ` Johannes Weiner
2022-02-14 16:46     ` Johannes Weiner
2022-02-14 19:53     ` Roman Gushchin
2022-02-14 19:53       ` Roman Gushchin
2022-02-15 18:01     ` Sebastian Andrzej Siewior
2022-02-15 18:01       ` Sebastian Andrzej Siewior
2022-02-11 22:35 ` [PATCH v2 4/4] mm/memcg: Protect memcg_stock with a local_lock_t Sebastian Andrzej Siewior
2022-02-11 22:35   ` Sebastian Andrzej Siewior
2022-02-14 16:23   ` Johannes Weiner
2022-02-14 16:23     ` Johannes Weiner
2022-02-16 15:51     ` Sebastian Andrzej Siewior
2022-02-16 15:51       ` Sebastian Andrzej Siewior
2022-02-16 18:08       ` Johannes Weiner
2022-02-16 18:08         ` Johannes Weiner
2022-02-17  9:28         ` Sebastian Andrzej Siewior
2022-02-17  9:28           ` Sebastian Andrzej Siewior
2022-02-12 10:39 [PATCH v2 1/4] mm/memcg: Revert ("mm/memcg: optimize user context object stock access") kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.