]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Nov 2019 16:34:29 +0000 (17:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Nov 2019 16:34:29 +0000 (17:34 +0100)
added patches:
cgroup-writeback-don-t-switch-wbs-immediately-on-dead-wbs-if-the-memcg-is-dead.patch
mm-filemap.c-don-t-initiate-writeback-if-mapping-has-no-dirty-pages.patch

queue-4.4/can-flexcan-disable-completely-the-ecc-mechanism.patch
queue-4.4/cgroup-writeback-don-t-switch-wbs-immediately-on-dead-wbs-if-the-memcg-is-dead.patch [new file with mode: 0644]
queue-4.4/mm-filemap.c-don-t-initiate-writeback-if-mapping-has-no-dirty-pages.patch [new file with mode: 0644]
queue-4.4/perf-x86-amd-ibs-fix-reading-of-the-ibs-opdata-regis.patch
queue-4.4/series

index 643f0853e8947da74feb735ac560073b6b6005aa..88bd1782e47f9faddbb2d698585965301e63a082 100644 (file)
@@ -19,14 +19,12 @@ Cc: linux-stable <stable@vger.kernel.org>
 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/net/can/flexcan.c | 1 +
+ drivers/net/can/flexcan.c |    1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
-index baef09b9449f9..6b866d0451b21 100644
 --- a/drivers/net/can/flexcan.c
 +++ b/drivers/net/can/flexcan.c
-@@ -923,6 +923,7 @@ static int flexcan_chip_start(struct net_device *dev)
+@@ -923,6 +923,7 @@ static int flexcan_chip_start(struct net
                reg_mecr = flexcan_read(&regs->mecr);
                reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS;
                flexcan_write(reg_mecr, &regs->mecr);
@@ -34,6 +32,3 @@ index baef09b9449f9..6b866d0451b21 100644
                reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK |
                              FLEXCAN_MECR_FANCEI_MSK);
                flexcan_write(reg_mecr, &regs->mecr);
--- 
-2.20.1
-
diff --git a/queue-4.4/cgroup-writeback-don-t-switch-wbs-immediately-on-dead-wbs-if-the-memcg-is-dead.patch b/queue-4.4/cgroup-writeback-don-t-switch-wbs-immediately-on-dead-wbs-if-the-memcg-is-dead.patch
new file mode 100644 (file)
index 0000000..f28145e
--- /dev/null
@@ -0,0 +1,62 @@
+From 65de03e251382306a4575b1779c57c87889eee49 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Fri, 8 Nov 2019 12:18:29 -0800
+Subject: cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 65de03e251382306a4575b1779c57c87889eee49 upstream.
+
+cgroup writeback tries to refresh the associated wb immediately if the
+current wb is dead.  This is to avoid keeping issuing IOs on the stale
+wb after memcg - blkcg association has changed (ie. when blkcg got
+disabled / enabled higher up in the hierarchy).
+
+Unfortunately, the logic gets triggered spuriously on inodes which are
+associated with dead cgroups.  When the logic is triggered on dead
+cgroups, the attempt fails only after doing quite a bit of work
+allocating and initializing a new wb.
+
+While c3aab9a0bd91 ("mm/filemap.c: don't initiate writeback if mapping
+has no dirty pages") alleviated the issue significantly as it now only
+triggers when the inode has dirty pages.  However, the condition can
+still be triggered before the inode is switched to a different cgroup
+and the logic simply doesn't make sense.
+
+Skip the immediate switching if the associated memcg is dying.
+
+This is a simplified version of the following two patches:
+
+ * https://lore.kernel.org/linux-mm/20190513183053.GA73423@dennisz-mbp/
+ * http://lkml.kernel.org/r/156355839560.2063.5265687291430814589.stgit@buzz
+
+Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Fixes: e8a7abf5a5bd ("writeback: disassociate inodes from dying bdi_writebacks")
+Acked-by: Dennis Zhou <dennis@kernel.org>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/fs-writeback.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/fs/fs-writeback.c
++++ b/fs/fs-writeback.c
+@@ -582,10 +582,13 @@ void wbc_attach_and_unlock_inode(struct
+       spin_unlock(&inode->i_lock);
+       /*
+-       * A dying wb indicates that the memcg-blkcg mapping has changed
+-       * and a new wb is already serving the memcg.  Switch immediately.
++       * A dying wb indicates that either the blkcg associated with the
++       * memcg changed or the associated memcg is dying.  In the first
++       * case, a replacement wb should already be available and we should
++       * refresh the wb immediately.  In the second case, trying to
++       * refresh will keep failing.
+        */
+-      if (unlikely(wb_dying(wbc->wb)))
++      if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))
+               inode_switch_wbs(inode, wbc->wb_id);
+ }
diff --git a/queue-4.4/mm-filemap.c-don-t-initiate-writeback-if-mapping-has-no-dirty-pages.patch b/queue-4.4/mm-filemap.c-don-t-initiate-writeback-if-mapping-has-no-dirty-pages.patch
new file mode 100644 (file)
index 0000000..06402a4
--- /dev/null
@@ -0,0 +1,49 @@
+From c3aab9a0bd91b696a852169479b7db1ece6cbf8c Mon Sep 17 00:00:00 2001
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Date: Mon, 23 Sep 2019 15:34:45 -0700
+Subject: mm/filemap.c: don't initiate writeback if mapping has no dirty pages
+
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+
+commit c3aab9a0bd91b696a852169479b7db1ece6cbf8c upstream.
+
+Functions like filemap_write_and_wait_range() should do nothing if inode
+has no dirty pages or pages currently under writeback.  But they anyway
+construct struct writeback_control and this does some atomic operations if
+CONFIG_CGROUP_WRITEBACK=y - on fast path it locks inode->i_lock and
+updates state of writeback ownership, on slow path might be more work.
+Current this path is safely avoided only when inode mapping has no pages.
+
+For example generic_file_read_iter() calls filemap_write_and_wait_range()
+at each O_DIRECT read - pretty hot path.
+
+This patch skips starting new writeback if mapping has no dirty tags set.
+If writeback is already in progress filemap_write_and_wait_range() will
+wait for it.
+
+Link: http://lkml.kernel.org/r/156378816804.1087.8607636317907921438.stgit@buzz
+Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Cc: Tejun Heo <tj@kernel.org>
+Cc: Jens Axboe <axboe@kernel.dk>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/filemap.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/mm/filemap.c
++++ b/mm/filemap.c
+@@ -340,7 +340,8 @@ int __filemap_fdatawrite_range(struct ad
+               .range_end = end,
+       };
+-      if (!mapping_cap_writeback_dirty(mapping))
++      if (!mapping_cap_writeback_dirty(mapping) ||
++          !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
+               return 0;
+       wbc_attach_fdatawrite_inode(&wbc, mapping->host);
index ce501a7fca641da1926da37dac192d50c6b69e24..ec4853af00d8776fcf825d2de12afac49db8edd5 100644 (file)
@@ -34,14 +34,12 @@ Link: https://lkml.kernel.org/r/20191023150955.30292-1-kim.phillips@amd.com
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- arch/x86/kernel/cpu/perf_event_amd_ibs.c | 2 +-
+ arch/x86/kernel/cpu/perf_event_amd_ibs.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
-index 989d3c215d2bc..66ca6ec09bd42 100644
 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
 +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
-@@ -555,7 +555,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
+@@ -555,7 +555,7 @@ static int perf_ibs_handle_irq(struct pe
        if (event->attr.sample_type & PERF_SAMPLE_RAW)
                offset_max = perf_ibs->offset_max;
        else if (check_rip)
@@ -50,6 +48,3 @@ index 989d3c215d2bc..66ca6ec09bd42 100644
        else
                offset_max = 1;
        do {
--- 
-2.20.1
-
index 10cb7a08c5e3126813d3b60a2c0e4b01d43edbd1..f3d6b05c285a0b27f7835f915c4487a2c06e70d1 100644 (file)
@@ -39,3 +39,5 @@ nfsv4-don-t-allow-a-cached-open-with-a-revoked-deleg.patch
 igb-fix-constant-media-auto-sense-switching-when-no-.patch
 e1000-fix-memory-leaks.patch
 can-flexcan-disable-completely-the-ecc-mechanism.patch
+mm-filemap.c-don-t-initiate-writeback-if-mapping-has-no-dirty-pages.patch
+cgroup-writeback-don-t-switch-wbs-immediately-on-dead-wbs-if-the-memcg-is-dead.patch