Skip to content

mm: fix priority queue in multigenerational lru - #220

Merged
damentz merged 1 commit into
5.13/lrufrom
unknown repository
Jul 22, 2021
Merged

damentz merged 1 commit into
5.13/lrufrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 22, 2021

Copy link
Copy Markdown

The priority queue helps select the best memcg to reclaim memory from
when there are multiple candidates. If reclaim didn't make progress
after it has tried those at the front, it increments the priority of
the rest in the queue by one. If the queue is not empty, more memcgs
will appear at the front and then reclaim will try them again.

However, this wasn't properly implemented, which causes the memory
pressure to be distributed to all memcgs in the queue. If one of them
uses a large amount of page cache, the distributed memory pressure
will slow down the rest.

Signed-off-by: Yu Zhao [email protected]

The priority queue helps select the best memcg to reclaim memory from
when there are multiple candidates. If reclaim didn't make progress
after it has tried those at the front, it increments the priority of
the rest in the queue by one. If the queue is not empty, more memcgs
will appear at the front and then reclaim will try them again.

However, this wasn't properly implemented, which causes the memory
pressure to be distributed to all memcgs in the queue. If one of them
uses a large amount of page cache, the distributed memory pressure
will slow down the rest.

Signed-off-by: Yu Zhao <[email protected]>
@damentz
damentz merged commit 0bc9425 into zen-kernel:5.13/lru Jul 22, 2021
damentz added a commit that referenced this pull request Jul 22, 2021
Make way for complete patch from Yu in #220

This reverts commit 29b51ca, reversing
changes made to 1efbf88.
@damentz

damentz commented Jul 22, 2021 •

Copy link
Copy Markdown
Member

Thanks, merged then rebased/squashed your change on top of the commit already there to keep the patch itself clean for 5.13.

damentz pushed a commit that referenced this pull request Feb 27, 2023
[ Upstream commit 17122c0 ]

Treat any exception during instruction decode for EMULTYPE_SKIP as a
"full" emulation failure, i.e. signal failure instead of queuing the
exception.  When decoding purely to skip an instruction, KVM and/or the
CPU has already done some amount of emulation that cannot be unwound,
e.g. on an EPT misconfig VM-Exit KVM has already processeed the emulated
MMIO.  KVM already does this if a #UD is encountered, but not for other
exceptions, e.g. if a #PF is encountered during fetch.

In SVM's soft-injection use case, queueing the exception is particularly
problematic as queueing exceptions while injecting events can put KVM
into an infinite loop due to bailing from VM-Enter to service the newly
pending exception.  E.g. multiple warnings to detect such behavior fire:

  ------------[ cut here ]------------
  WARNING: CPU: 3 PID: 1017 at arch/x86/kvm/x86.c:9873 kvm_arch_vcpu_ioctl_run+0x1de5/0x20a0 [kvm]
  Modules linked in: kvm_amd ccp kvm irqbypass
  CPU: 3 PID: 1017 Comm: svm_nested_soft Not tainted 6.0.0-rc1+ #220
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_arch_vcpu_ioctl_run+0x1de5/0x20a0 [kvm]
  Call Trace:
   kvm_vcpu_ioctl+0x223/0x6d0 [kvm]
   __x64_sys_ioctl+0x85/0xc0
   do_syscall_64+0x2b/0x50
   entry_SYSCALL_64_after_hwframe+0x46/0xb0
  ---[ end trace 0000000000000000 ]---
  ------------[ cut here ]------------
  WARNING: CPU: 3 PID: 1017 at arch/x86/kvm/x86.c:9987 kvm_arch_vcpu_ioctl_run+0x12a3/0x20a0 [kvm]
  Modules linked in: kvm_amd ccp kvm irqbypass
  CPU: 3 PID: 1017 Comm: svm_nested_soft Tainted: G        W          6.0.0-rc1+ #220
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_arch_vcpu_ioctl_run+0x12a3/0x20a0 [kvm]
  Call Trace:
   kvm_vcpu_ioctl+0x223/0x6d0 [kvm]
   __x64_sys_ioctl+0x85/0xc0
   do_syscall_64+0x2b/0x50
   entry_SYSCALL_64_after_hwframe+0x46/0xb0
  ---[ end trace 0000000000000000 ]---

Fixes: 6ea6e84 ("KVM: x86: inject exceptions produced by x86_decode_insn")
Signed-off-by: Sean Christopherson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants