Re: [PATCH] fs/writeback: Attach inode's wb to root if needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tejun,

在 2019/5/10 0:48, Tejun Heo 写道:
Hi Tejun,

On Thu, May 09, 2019 at 04:03:53PM +0800, zhangliguang wrote:
There might have tons of files queued in the writeback, awaiting for
writing back. Unfortunately, the writeback's cgroup has been dead. In
this case, we reassociate the inode with another writeback cgroup, but
we possibly can't because the writeback associated with the dead cgroup
is the only valid one. In this case, the new writeback is allocated,
initialized and associated with the inode. It causes unnecessary high
system load and latency.

This fixes the issue by enforce moving the inode to root cgroup when the
previous binding cgroup becomes dead. With it, no more unnecessary
writebacks are created, populated and the system load decreased by about
6x in the online service we encounted:
     Without the patch: about 30% system load
     With the patch:    about  5% system load
Can you please describe the scenario with more details?  I'm having a
bit of hard time understanding the amount of cpu cycles being
consumed.

Thanks.

Our search line reported a problem, when containerA was removed,
containerB and containerC's system load were up to 30%.

We record the trace with 'perf record cycles:k -g -a', found that wb_init
was the hotspot function.

Function call:

generic_file_direct_write
   filemap_write_and_wait_range
      __filemap_fdatawrite_range
         wbc_attach_fdatawrite_inode
            inode_attach_wb
               __inode_attach_wb
                  wb_get_create
            wbc_attach_and_unlock_inode
               if (unlikely(wb_dying(wbc->wb)))
                  inode_switch_wbs
                     wb_get_create
                        ; Search bdi->cgwb_tree from memcg_css->id
                        ; OR cgwb_create
                           kmalloc
                           wb_init       // hot spot
                           ; Insert to bdi->cgwb_tree, mmecg_css->id as key

We discussed it through, base on the analysis:  When we running into the
issue, there is cgroups are being deleted. The inodes (files) that were
associated with these cgroups have to switch into another newly created
writeback. We think there are huge amount of inodes in the writeback list
that time. So we don't think there is anything abnormal. However, one
thing we possibly can do: enforce these inodes to BDI embedded wirteback
and we needn't create huge amount of writebacks in that case, to avoid
the high system load phenomenon. We expect correct wb (best candidate) is
picked up in next round.

Thanks,
Liguang





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux