All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch
@ 2024-04-18 19:44 Andrew Morton
  2024-04-19  1:21 ` Kefeng Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2024-04-18 19:44 UTC (permalink / raw)
  To: mm-commits, tj, wangkefeng.wang, akpm


The patch titled
     Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
has been added to the -mm mm-unstable branch.  Its filename is
     mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
Date: Thu, 18 Apr 2024 21:56:44 +0800

Skip blk_cgroup_congested() if there is no usable swap device since no
swapin/out will occur, Thereby avoid taking swap_lock.  The difference is
shown below from perf date of CoW pagefault,

 perf report -g -i perf.data.swapoff  | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
     1.01%     0.16%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
     0.83%     0.80%  page_fault2_pro  [kernel.kallsyms]      [k] blk_cgroup_congested

 perf report -g -i perf.data.swapon   | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
     0.15%     0.15%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate

Link: https://lkml.kernel.org/r/20240418135644.2736748-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/swapfile.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/mm/swapfile.c~mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate
+++ a/mm/swapfile.c
@@ -2444,13 +2444,17 @@ static void reinsert_swap_info(struct sw
 	spin_unlock(&swap_lock);
 }
 
+static bool __has_usable_swap(void)
+{
+	return !plist_head_empty(&swap_active_head);
+}
+
 bool has_usable_swap(void)
 {
-	bool ret = true;
+	bool ret;
 
 	spin_lock(&swap_lock);
-	if (plist_head_empty(&swap_active_head))
-		ret = false;
+	ret = __has_usable_swap();
 	spin_unlock(&swap_lock);
 	return ret;
 }
@@ -3710,6 +3714,9 @@ void __folio_throttle_swaprate(struct fo
 	if (!(gfp & __GFP_IO))
 		return;
 
+	if (!__has_usable_swap())
+		return;
+
 	if (!blk_cgroup_congested())
 		return;
 
_

Patches currently in -mm which might be from wangkefeng.wang@huawei.com are

mm-backing-dev-use-group-allocation-free-of-per-cpu-counters-api.patch
mm-remove-__set_page_dirty_nobuffers.patch
arm64-mm-cleanup-__do_page_fault.patch
arm64-mm-accelerate-pagefault-when-vm_fault_badaccess.patch
arm-mm-accelerate-pagefault-when-vm_fault_badaccess.patch
powerpc-mm-accelerate-pagefault-when-badaccess.patch
riscv-mm-accelerate-pagefault-when-badaccess.patch
riscv-mm-accelerate-pagefault-when-badaccess-fix.patch
s390-mm-accelerate-pagefault-when-badaccess.patch
x86-mm-accelerate-pagefault-when-badaccess.patch
arm64-mm-drop-vm_fault_badmap-vm_fault_badaccess.patch
arm-mm-drop-vm_fault_badmap-vm_fault_badaccess.patch
mm-move-mm-counter-updating-out-of-set_pte_range.patch
mm-filemap-batch-mm-counter-updating-in-filemap_map_pages.patch
mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch


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

* Re: + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch
  2024-04-18 19:44 + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch Andrew Morton
@ 2024-04-19  1:21 ` Kefeng Wang
  2024-04-22 21:56   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Kefeng Wang @ 2024-04-19  1:21 UTC (permalink / raw)
  To: Andrew Morton, mm-commits, tj


Hi Andrew,

On 2024/4/19 3:44, Andrew Morton wrote:
> 

> 
> ------------------------------------------------------
> From: Kefeng Wang <wangkefeng.wang@huawei.com>
> Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
> Date: Thu, 18 Apr 2024 21:56:44 +0800
> 
> Skip blk_cgroup_congested() if there is no usable swap device since no
> swapin/out will occur, Thereby avoid taking swap_lock.  The difference is
> shown below from perf date of CoW pagefault,

Thanks your for help to improving changelog, so kind to me.

> 
>   perf report -g -i perf.data.swapoff  | egrep "blk_cgroup_congested|__folio_throttle_swaprate"

I make a mistake, this should swapon

>       1.01%     0.16%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
>       0.83%     0.80%  page_fault2_pro  [kernel.kallsyms]      [k] blk_cgroup_congested
> 
>   perf report -g -i perf.data.swapon   | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
and  this is swapoff

We don't use swap in our scene, so avoid blk_cgroup_congested(), could
you help to correct it too, thanks


>       0.15%     0.15%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
> 

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

* Re: + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch
  2024-04-19  1:21 ` Kefeng Wang
@ 2024-04-22 21:56   ` Andrew Morton
  2024-04-23  4:56     ` Kefeng Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2024-04-22 21:56 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: mm-commits, tj

On Fri, 19 Apr 2024 09:21:06 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> 
> Hi Andrew,
> 
> On 2024/4/19 3:44, Andrew Morton wrote:
> > 
> 
> > 
> > ------------------------------------------------------
> > From: Kefeng Wang <wangkefeng.wang@huawei.com>
> > Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
> > Date: Thu, 18 Apr 2024 21:56:44 +0800
> > 
> > Skip blk_cgroup_congested() if there is no usable swap device since no
> > swapin/out will occur, Thereby avoid taking swap_lock.  The difference is
> > shown below from perf date of CoW pagefault,
> 
> Thanks your for help to improving changelog, so kind to me.
> 
> > 
> >   perf report -g -i perf.data.swapoff  | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
> 
> I make a mistake, this should swapon
> 
> >       1.01%     0.16%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
> >       0.83%     0.80%  page_fault2_pro  [kernel.kallsyms]      [k] blk_cgroup_congested
> > 
> >   perf report -g -i perf.data.swapon   | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
> and  this is swapoff
> 
> We don't use swap in our scene, so avoid blk_cgroup_congested(), could
> you help to correct it too, thanks
> 
> 
> >       0.15%     0.15%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
> > 

Please send me the new changelog text and I'll paste it in, thanks.

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

* Re: + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch
  2024-04-22 21:56   ` Andrew Morton
@ 2024-04-23  4:56     ` Kefeng Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Kefeng Wang @ 2024-04-23  4:56 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, tj



On 2024/4/23 5:56, Andrew Morton wrote:
> On Fri, 19 Apr 2024 09:21:06 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> 
>>
>> Hi Andrew,
>>
>> On 2024/4/19 3:44, Andrew Morton wrote:
>>>
>>
>>>
>>> ------------------------------------------------------
>>> From: Kefeng Wang <wangkefeng.wang@huawei.com>
>>> Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
>>> Date: Thu, 18 Apr 2024 21:56:44 +0800
>>>
>>> Skip blk_cgroup_congested() if there is no usable swap device since no
>>> swapin/out will occur, Thereby avoid taking swap_lock.  The difference is
>>> shown below from perf date of CoW pagefault,
>>
>> Thanks your for help to improving changelog, so kind to me.
>>
>>>
>>>    perf report -g -i perf.data.swapoff  | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
>>
>> I make a mistake, this should swapon
>>
>>>        1.01%     0.16%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
>>>        0.83%     0.80%  page_fault2_pro  [kernel.kallsyms]      [k] blk_cgroup_congested
>>>
>>>    perf report -g -i perf.data.swapon   | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
>> and  this is swapoff
>>
>> We don't use swap in our scene, so avoid blk_cgroup_congested(), could
>> you help to correct it too, thanks
>>
>>
>>>        0.15%     0.15%  page_fault2_pro  [kernel.kallsyms]      [k] __folio_throttle_swaprate
>>>
> 
> Please send me the new changelog text and I'll paste it in, thanks.

Here, thank you, Andrew

Skip blk_cgroup_congested() if there is no usable swap device since no
swapin/out will occur, Thereby avoid taking swap_lock.  The difference is
shown below from perf date of CoW pagefault,

  perf report -g -i perf.data.swapon  | egrep 
"blk_cgroup_congested|__folio_throttle_swaprate"
      1.01%     0.16%  page_fault2_pro  [kernel.kallsyms]      [k] 
__folio_throttle_swaprate
      0.83%     0.80%  page_fault2_pro  [kernel.kallsyms]      [k] 
blk_cgroup_congested

  perf report -g -i perf.data.swapoff   | egrep 
"blk_cgroup_congested|__folio_throttle_swaprate"
      0.15%     0.15%  page_fault2_pro  [kernel.kallsyms]      [k] 
__folio_throttle_swaprate


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

end of thread, other threads:[~2024-04-23  4:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 19:44 + mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch added to mm-unstable branch Andrew Morton
2024-04-19  1:21 ` Kefeng Wang
2024-04-22 21:56   ` Andrew Morton
2024-04-23  4:56     ` Kefeng Wang

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.