Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memcg: manually inline __refill_stock

There are no more multiple callers of __refill_stock(), so simply inline
it to refill_stock().

Link: https://lkml.kernel.org/r/20250404013913.1663035-5-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Shakeel Butt and committed by
Andrew Morton
cbc09144 89f342af

+14 -22
+14 -22
mm/memcontrol.c
··· 1871 1871 obj_cgroup_put(old); 1872 1872 } 1873 1873 1874 - /* 1875 - * Cache charges(val) to local per_cpu area. 1876 - * This will be consumed by consume_stock() function, later. 1877 - */ 1878 - static void __refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) 1874 + static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) 1879 1875 { 1880 1876 struct memcg_stock_pcp *stock; 1881 1877 unsigned int stock_pages; 1882 - 1883 - stock = this_cpu_ptr(&memcg_stock); 1884 - if (READ_ONCE(stock->cached) != memcg) { /* reset if necessary */ 1885 - drain_stock(stock); 1886 - css_get(&memcg->css); 1887 - WRITE_ONCE(stock->cached, memcg); 1888 - } 1889 - stock_pages = READ_ONCE(stock->nr_pages) + nr_pages; 1890 - WRITE_ONCE(stock->nr_pages, stock_pages); 1891 - 1892 - if (stock_pages > MEMCG_CHARGE_BATCH) 1893 - drain_stock(stock); 1894 - } 1895 - 1896 - static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) 1897 - { 1898 1878 unsigned long flags; 1899 1879 1900 1880 VM_WARN_ON_ONCE(mem_cgroup_is_root(memcg)); ··· 1887 1907 memcg_uncharge(memcg, nr_pages); 1888 1908 return; 1889 1909 } 1890 - __refill_stock(memcg, nr_pages); 1910 + 1911 + stock = this_cpu_ptr(&memcg_stock); 1912 + if (READ_ONCE(stock->cached) != memcg) { /* reset if necessary */ 1913 + drain_stock(stock); 1914 + css_get(&memcg->css); 1915 + WRITE_ONCE(stock->cached, memcg); 1916 + } 1917 + stock_pages = READ_ONCE(stock->nr_pages) + nr_pages; 1918 + WRITE_ONCE(stock->nr_pages, stock_pages); 1919 + 1920 + if (stock_pages > MEMCG_CHARGE_BATCH) 1921 + drain_stock(stock); 1922 + 1891 1923 local_unlock_irqrestore(&memcg_stock.stock_lock, flags); 1892 1924 } 1893 1925