linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Michal Hocko <mhocko@suse.com>, Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-mm@kvack.org
Subject: [PATCH AUTOSEL 4.19 28/48] mm: handle lru_add_drain_all for UP properly
Date: Wed, 13 Mar 2019 15:12:30 -0400	[thread overview]
Message-ID: <20190313191250.158955-28-sashal@kernel.org> (raw)
In-Reply-To: <20190313191250.158955-1-sashal@kernel.org>

From: Michal Hocko <mhocko@suse.com>

[ Upstream commit 6ea183d60c469560e7b08a83c9804299e84ec9eb ]

Since for_each_cpu(cpu, mask) added by commit 2d3854a37e8b767a
("cpumask: introduce new API, without changing anything") did not
evaluate the mask argument if NR_CPUS == 1 due to CONFIG_SMP=n,
lru_add_drain_all() is hitting WARN_ON() at __flush_work() added by
commit 4d43d395fed12463 ("workqueue: Try to catch flush_work() without
INIT_WORK().") by unconditionally calling flush_work() [1].

Workaround this issue by using CONFIG_SMP=n specific lru_add_drain_all
implementation.  There is no real need to defer the implementation to
the workqueue as the draining is going to happen on the local cpu.  So
alias lru_add_drain_all to lru_add_drain which does all the necessary
work.

[akpm@linux-foundation.org: fix various build warnings]
[1] https://lkml.kernel.org/r/18a30387-6aa5-6123-e67c-57579ecc3f38@roeck-us.net
Link: http://lkml.kernel.org/r/20190213124334.GH4525@dhcp22.suse.cz
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Debugged-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 mm/swap.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index 26fc9b5f1b6c..a3fc028e338e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -321,11 +321,6 @@ static inline void activate_page_drain(int cpu)
 {
 }
 
-static bool need_activate_page_drain(int cpu)
-{
-	return false;
-}
-
 void activate_page(struct page *page)
 {
 	struct zone *zone = page_zone(page);
@@ -654,13 +649,15 @@ void lru_add_drain(void)
 	put_cpu();
 }
 
+#ifdef CONFIG_SMP
+
+static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
+
 static void lru_add_drain_per_cpu(struct work_struct *dummy)
 {
 	lru_add_drain();
 }
 
-static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
-
 /*
  * Doesn't need any cpu hotplug locking because we do rely on per-cpu
  * kworkers being shut down before our page_alloc_cpu_dead callback is
@@ -703,6 +700,12 @@ void lru_add_drain_all(void)
 
 	mutex_unlock(&lock);
 }
+#else
+void lru_add_drain_all(void)
+{
+	lru_add_drain();
+}
+#endif
 
 /**
  * release_pages - batched put_page()
-- 
2.19.1


  parent reply	other threads:[~2019-03-13 19:27 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:12 [PATCH AUTOSEL 4.19 01/48] clk: sunxi-ng: v3s: Fix TCON reset de-assert bit Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 02/48] kallsyms: Handle too long symbols in kallsyms.c Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 03/48] clk: sunxi: A31: Fix wrong AHB gate number Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 04/48] esp: Skip TX bytes accounting when sending from a request socket Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 05/48] ARM: 8824/1: fix a migrating irq bug when hotplug cpu Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 06/48] bpf: only adjust gso_size on bytestream protocols Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 07/48] bpf: fix lockdep false positive in stackmap Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 08/48] af_key: unconditionally clone on broadcast Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 09/48] ARM: 8835/1: dma-mapping: Clear DMA ops on teardown Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 10/48] assoc_array: Fix shortcut creation Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 11/48] keys: Fix dependency loop between construction record and auth key Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 12/48] scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 13/48] net: systemport: Fix reception of BPDUs Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 14/48] net: dsa: bcm_sf2: Do not assume DSA master supports WoL Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 15/48] pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 16/48] qmi_wwan: apply SET_DTR quirk to Sierra WP7607 Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 17/48] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 18/48] xfrm: Fix inbound traffic via XFRM interfaces across network namespaces Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 19/48] mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush timeout issue Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 20/48] ASoC: topology: free created components in tplg load error Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 21/48] qed: Fix iWARP buffer size provided for syn packet processing Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 22/48] qed: Fix iWARP syn packet mac address validation Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 23/48] ARM: dts: armada-xp: fix Armada XP boards NAND description Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 24/48] arm64: Relax GIC version check during early boot Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 25/48] ARM: tegra: Restore DT ABI on Tegra124 Chromebooks Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 26/48] net: marvell: mvneta: fix DMA debug warning Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 27/48] kasan, slub: move kasan_poison_slab hook before page_address Sasha Levin
2019-03-13 19:12 ` Sasha Levin [this message]
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 29/48] tmpfs: fix link accounting when a tmpfile is linked in Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 30/48] kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 31/48] kasan, slab: make freelist stored without tags Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 32/48] ixgbe: fix older devices that do not support IXGBE_MRQC_L3L4TXSWEN Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 33/48] ARCv2: lib: memcpy: fix doing prefetchw outside of buffer Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 34/48] ARC: uacces: remove lp_start, lp_end from clobber list Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 35/48] ARCv2: support manual regfile save on interrupts Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 36/48] ARCv2: don't assume core 0x54 has dual issue Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 37/48] phonet: fix building with clang Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 38/48] mac80211_hwsim: propagate genlmsg_reply return code Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 39/48] bpf, lpm: fix lookup bug in map_delete_elem Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 40/48] net: thunderx: make CFG_DONE message to run through generic send-ack sequence Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 41/48] net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 42/48] nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 43/48] nfp: bpf: fix ALU32 high bits clearance bug Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 44/48] bnxt_en: Fix typo in firmware message timeout logic Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 45/48] bnxt_en: Wait longer for the firmware message response to complete Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 46/48] mdio_bus: Fix use-after-free on device_register fails Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 47/48] net: set static variable an initial value in atl2_probe() Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 48/48] selftests: fib_tests: sleep after changing carrier. again Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313191250.158955-28-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).