1
0
Fork 0
alistair23-linux/include
Vlastimil Babka 5556cfe8d9 mm, page_owner: fix off-by-one error in __set_page_owner_handle()
Patch series "followups to debug_pagealloc improvements through
page_owner", v3.

These are followups to [1] which made it to Linus meanwhile.  Patches 1
and 3 are based on Kirill's review, patch 2 on KASAN request [2].  It
would be nice if all of this made it to 5.4 with [1] already there (or
at least Patch 1).

This patch (of 3):

As noted by Kirill, commit 7e2f2a0cd1 ("mm, page_owner: record page
owner for each subpage") has introduced an off-by-one error in
__set_page_owner_handle() when looking up page_ext for subpages.  As a
result, the head page page_owner info is set twice, while for the last
tail page, it's not set at all.

Fix this and also make the code more efficient by advancing the page_ext
pointer we already have, instead of calling lookup_page_ext() for each
subpage.  Since the full size of struct page_ext is not known at compile
time, we can't use a simple page_ext++ statement, so introduce a
page_ext_next() inline function for that.

Link: http://lkml.kernel.org/r/20190930122916.14969-2-vbabka@suse.cz
Fixes: 7e2f2a0cd1 ("mm, page_owner: record page owner for each subpage")
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Kirill A. Shutemov <kirill@shutemov.name>
Reported-by: Miles Chen <miles.chen@mediatek.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Walter Wu <walter-zh.wu@mediatek.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-10-14 15:04:00 -07:00
..
acpi ACPI updates for 5.4-rc1 2019-09-17 19:31:36 -07:00
asm-generic Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
clocksource clocksource/drivers/hyperv: Enable TSC page clocksource on 32bit 2019-08-23 16:59:54 +02:00
crypto Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity 2019-09-27 19:37:27 -07:00
drm drm: Measure Self Refresh Entry/Exit times to avoid thrashing 2019-09-19 10:03:32 -04:00
dt-bindings Main MIPS changes for v5.4: 2019-09-22 09:30:30 -07:00
keys
kvm KVM: arm/arm64: vgic: Use a single IO device per redistributor 2019-08-25 11:02:52 +01:00
linux mm, page_owner: fix off-by-one error in __set_page_owner_handle() 2019-10-14 15:04:00 -07:00
math-emu nds32: Mark expected switch fall-throughs 2019-08-29 11:06:56 -05:00
media media: v4l2-core: introduce a helper to unregister a i2c subdev 2019-08-26 10:52:06 -03:00
misc auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay 2019-08-08 19:59:17 +02:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf 2019-09-27 20:15:00 +02:00
pcmcia
ras
rdma RDMA subsystem updates for 5.4 2019-09-21 10:26:24 -07:00
scsi SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
soc Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
sound ASoC: Updates for v5.4 2019-09-10 13:03:08 +02:00
target
trace Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-10-05 08:50:15 -07:00
uapi TTY/Serial driver fixes for 5.4-rc3 2019-10-12 15:42:19 -07:00
vdso
video fbdev: da8xx: remove panel_power_ctrl() callback from platform data 2019-08-26 17:53:58 +05:30
xen xen: fixes and cleanups for 5.4-rc2 2019-10-04 11:13:09 -07:00
Kbuild - New Drivers 2019-09-23 19:37:49 -07:00