Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync up with master #7

Merged
merged 165 commits into from
Nov 15, 2014
Merged
Changes from 1 commit
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
aa1cf25
ata: sata_rcar: Disable DIPM mode for r8a7790 ES1
horms Oct 27, 2014
03e83cb
Revert "AHCI: Do not acquire ata_host::lock from single IRQ handler"
htejun Oct 27, 2014
7865f83
Revert "AHCI: Optimize single IRQ interrupt processing"
htejun Oct 27, 2014
66a7cbc
ahci: disable MSI instead of NCQ on Samsung pci-e SSDs on macbooks
htejun Oct 27, 2014
690000b
ahci: Add Device IDs for Intel Sunrise Point PCH
jamesdralston Oct 13, 2014
e35b988
ata: sata_rcar: Add r8a7793 device support
KojiMatsuoka Oct 28, 2014
7b358f0
iwlwifi: mvm: initialize the cur_ucode upon boot
egrumbach Oct 23, 2014
805dbe1
mac80211_hwsim: release driver when ieee80211_register_hw fails
Oct 28, 2014
10b6848
mac80211: flush keys for AP mode on ieee80211_do_stop
Oct 27, 2014
84469a4
mac80211: use secondary channel offset IE also beacons during CSA
lucacoelho Oct 28, 2014
ff1e417
mac80211: schedule the actual switch of the station before CSA count 0
lucacoelho Oct 28, 2014
2225846
ACPI / blacklist: blacklist Win8 OSI for Dell Vostro 3546
Oct 27, 2014
4623884
mac80211: properly flush delayed scan work on interface removal
jmberg Oct 21, 2014
ece9c72
block: Fix computation of merged request priority
jankara Oct 30, 2014
ec1f127
sunhme: Add DMA mapping error checks.
davem330 Oct 31, 2014
4373747
net: mvpp2: fix possible memory leak
sudipm-mukherjee Nov 1, 2014
3e8fc38
net: systemport: fix DMA allocation/freeing sizes
ffainelli Oct 31, 2014
914adb5
net: systemport: do not crash freeing an unitialized TX ring
ffainelli Oct 31, 2014
1868855
Merge branch 'systemport-net'
davem330 Nov 1, 2014
1db3ddf
drivers: net: ethernet: xilinx: xilinx_emaclite: Compatible with 'xln…
Chen-Gang Nov 1, 2014
d52fdbb
smc91x: retrieve IRQ and trigger flags in a modern way
linusw Oct 31, 2014
fa51ee1
HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103
Oct 31, 2014
b8fff40
mac80211: fix use-after-free in defragmentation
jmberg-intel Nov 3, 2014
31b8b34
iwlwifi: fix RFkill while calibrating
egrumbach Nov 2, 2014
c1207c0
netfilter: nft_reject_bridge: Fix powerpc build error
groeck Nov 3, 2014
7071cf7
uapi: add missing network related headers to kbuild
shemminger Nov 2, 2014
a8f9bfd
tun: Fix csum_start with VLAN acceleration
herbertx Nov 2, 2014
2eb783c
tun: Fix TUN_PKT_STRIP setting
herbertx Nov 2, 2014
2b11e67
Merge branch 'tun-net'
davem330 Nov 3, 2014
f4c4a4e
net: fec: fix suspend broken on multiple MACs sillicons
Nov 3, 2014
3ce9b20
macvtap: Fix csum_start when VLAN tags are present
herbertx Nov 3, 2014
6c6151d
ip6_tunnel: Use ip6_tnl_dev_init as the ndo_init function.
klassert Nov 3, 2014
16a0231
vti6: Use vti6_dev_init as the ndo_init function.
klassert Nov 3, 2014
ebe084a
sit: Use ipip6_tunnel_init as the ndo_init function.
klassert Nov 3, 2014
f03eb12
gre6: Move the setting of dev->iflink into the ndo_init functions.
klassert Nov 3, 2014
c495d64
Merge branch 'ipv6_tunnel_iflink_init'
davem330 Nov 3, 2014
9fd3d3a
sfc: don't BUG_ON efx->max_channels == 0 in probe
ecree-solarflare Nov 3, 2014
9c5c6ed
HID: core: cleanup .claimed field on disconnect
bentiss Nov 3, 2014
9a23c1d
ahci: fix AHCI parameters not taken into account
atenart Nov 3, 2014
c00ed46
Merge tag 'iwlwifi-for-john-2014-11-03' of git://git.kernel.org/pub/s…
linvjw Nov 4, 2014
0c9a67c
Merge tag 'mac80211-for-john-2014-11-04' of git://git.kernel.org/pub/…
linvjw Nov 4, 2014
f3af020
blk-mq: make mq_queue_reinit_notify() freeze queues in parallel
htejun Nov 4, 2014
09c9e05
dtb: xgene: fix: Backward compatibility with older firmware
isubrama Nov 3, 2014
c3f4465
drivers: net: xgene: Backward compatibility with older firmware
isubrama Nov 3, 2014
bdd330f
drivers: net: xgene: fix: Use separate resources
isubrama Nov 3, 2014
15e4123
Merge branch 'xgene-net'
davem330 Nov 4, 2014
7179621
cpufreq: cpufreq-dt: Fix arguments in clock failure error message
Oct 31, 2014
45cac46
geneve: Set GSO type on transmit.
jessegross Nov 4, 2014
d3ca9ea
geneve: Unregister pernet subsys on module unload.
jessegross Nov 4, 2014
219b5f2
net: Add missing descriptions for fwmark_reflect for ipv4 and ipv6.
Nov 4, 2014
9cdb5db
include/linux/socket.h: Fix comment
Villemoes Nov 5, 2014
b994ca6
drivers: net: ethernet: xilinx: xilinx_emaclite: revert the original …
Chen-Gang Nov 4, 2014
16ee817
stmmac: fix stmmac_tx_avail should be called with TX locked
Nov 4, 2014
758a0ab
stmmac: release tx lock, in case of dma mapping error.
Nov 4, 2014
b9d7370
stmmac: fix lock in stmmac_set_rx_mode
Nov 4, 2014
4741cf9
stmmac: fix concurrency in eee initialization.
Nov 4, 2014
777da23
stmmac: fix atomicity in pm routines
Nov 4, 2014
46d3802
Merge branch 'stmmac-net'
davem330 Nov 5, 2014
1f37bf8
tcp: zero retrans_stamp if all retrans were acked
marceloleitner Nov 4, 2014
66f1c44
bridge: include in6.h in if_bridge.h for struct in6_addr
cha5on Nov 4, 2014
e4742b1
Input: synaptics - add min/max quirk for Lenovo T440s
tiwai Nov 6, 2014
2c2a9cb
net: mv643xx_eth: reclaim TX skbs only when released by the HW
Nov 5, 2014
4484d05
drivers: net: cpsw: remove cpsw_ale_stop from cpsw_ale_destroy
mugunthanvnm Nov 5, 2014
5816c3d
net/9p: remove a comment about pref member which doesn't exist
pfpacket Nov 5, 2014
b31f65f
net: dsa: slave: Fix autoneg for phys on switch MDIO bus
lunn Nov 5, 2014
a158906
net/mlx5_core: Fix race in create EQ
Nov 6, 2014
364d179
net/mlx5_core: Fix race on driver load
Nov 6, 2014
c811906
Merge branch 'mlx5-net'
davem330 Nov 6, 2014
44aa91a
enic: handle error condition properly in enic_rq_indicate_buf
Nov 6, 2014
f6b7734
enic: update desc properly in rx_copybreak
Nov 6, 2014
9d01412
netxen: Fix link event handling.
Nov 6, 2014
1f56231
Merge tag 'master-2014-11-04' of git://git.kernel.org/pub/scm/linux/k…
davem330 Nov 7, 2014
1310b54
net: fec: fix regression on i.MX28 introduced by rx_copybreak support
lw-karo Nov 7, 2014
a4c724d
platform: hp_accel: add a i8042 filter to remove HPQ6000 data from kb…
GiedriusS Oct 30, 2014
436c2a5
asix: Do full reset during ax88772_bind
charleskeepax Nov 6, 2014
09712f5
cpufreq: Avoid crash in resume on SMP without OPP
geertu Nov 4, 2014
c16561e
PM / Domains: Change prototype for the attach and detach callbacks
storulf Nov 5, 2014
c42bfd7
Input: twl4030-pwrbutton - ensure a wakeup event is recorded.
neilbrown Nov 7, 2014
caeb0d3
Input: elantech - use elantech_report_trackpoint for hardware v4 too
ulrikdb Nov 8, 2014
0dc1587
Input: elantech - fix crc_enabled for Fujitsu H730
ulrikdb Nov 8, 2014
b456591
ALSA: hda_intel: Add DeviceIDs for Sunrise Point-LP
dryles-intel Nov 7, 2014
403b963
PM / sleep: Fix entering suspend-to-IDLE if no freeze_oops is set
lumag Nov 8, 2014
4ab8f7f
Input: alps - ignore potential bare packets when device is out of sync
pali Nov 8, 2014
9d720b3
Input: alps - allow up to 2 invalid packets without resetting device
pali Nov 8, 2014
65f6ecc
cxgb4vf: Move fl_starv_thres into adapter->sge data structure
Nov 7, 2014
ce8f407
cxgb4/cxgb4vf: For T5 use Packing and Padding Boundaries for SGE DMA …
Nov 7, 2014
50d21a6
cxgb4vf: FL Starvation Threshold needs to be larger than the SGE's Eg…
Nov 7, 2014
10b450c
Merge branch 'cxgb4-net'
davem330 Nov 10, 2014
cfdf1e1
udptunnel: Add SKB_GSO_UDP_TUNNEL during gro_complete.
jessegross Nov 10, 2014
a815286
cxgb4 : Fix bug in DCB app deletion
anish Nov 7, 2014
92697dc
scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND
abattersby Nov 10, 2014
0cdbcd6
platform: hp_accel: Add SERIO_I8042 as a dependency since it now incl…
GiedriusS Nov 10, 2014
1a29058
ALSA: usb-audio: Fix memory leak in FTU quirk
tiwai Nov 11, 2014
f4a1edd
net/mlx4_en: Advertize encapsulation offloads features only when VXLA…
ogerlitz Nov 9, 2014
5748eb8
net: ppp: Don't call bpf_prog_create() in ppp_lock
tiwai Nov 10, 2014
e40607c
net: sctp: fix NULL pointer dereference in af->from_addr_param on mal…
Nov 10, 2014
4184b2a
net: sctp: fix memory leak in auth key management
Nov 10, 2014
5337b5b
ipv6: fix IPV6_PKTINFO with v4 mapped
Nov 11, 2014
79ce047
net: phy: Correctly handle MII ioctl which changes autonegotiation.
Nov 11, 2014
67732cd
PM / Domains: Fix initial default state of the need_restore flag
storulf Nov 11, 2014
48eb5b9
ixgbe: phy: fix uninitialized status in ixgbe_setup_phy_link_tnx
Nov 11, 2014
93ecd26
net: qualcomm: Fix dependency
lategoodbye Nov 11, 2014
c96e731
net: bcmgenet: connect and disconnect from the PHY state machine
ffainelli Nov 11, 2014
dbd479d
net: bcmgenet: apply MII configuration in bcmgenet_open()
ffainelli Nov 11, 2014
caa13a9
Merge branch 'bcmgenet-net'
davem330 Nov 11, 2014
7f60dca
block: blk-merge: fix blk_recount_segments()
ming1 Nov 11, 2014
fbf8e72
selftests/net: psock_fanout seg faults in sock_fanout_read_ring()
Nov 11, 2014
394c97f
ALSA: hda/realtek - Change EAPD to verb control
KailangYang Nov 12, 2014
ee7bc3c
cxgb4 : dcb open-lldp interop fixes
anish Nov 12, 2014
cca04b2
net: ptp: fix time stamp matching logic for VLAN packets.
richardcochran Nov 12, 2014
6251edd
netlink: Properly unbind in error conditions.
hiroa-ki Nov 12, 2014
65eca3a
virtio_console: move early VQ enablement
cohuck Oct 20, 2014
3542aed
ALSA: hda - Add mute LED control for Lenovo Ideapad Z560
tiwai Nov 12, 2014
9b0b265
arm64: efi: Fix stub cache maintenance
Nov 13, 2014
287e8c6
arm64: Fix data type for physical address
MilesMH Oct 8, 2014
97fc154
arm64: __clear_user: handle exceptions on strb
jkkm Nov 12, 2014
899d593
Correct the race condition in aarch64_insn_patch_text_sync()
wcohen Nov 11, 2014
5fd6690
arm64: ARCH_PFN_OFFSET should be unsigned long
Oct 28, 2014
3b98ec4
Merge tag 'sound-3.18-rc5' of git://git.kernel.org/pub/scm/linux/kern…
torvalds Nov 13, 2014
ad0eab9
Fix thinko in iov_iter_single_seg_count
paulusmack Nov 13, 2014
3231300
ceph: fix flush tid comparision
ukernel Oct 23, 2014
aaef317
libceph: do not crash on large auth tickets
idryomov Oct 22, 2014
a390de0
libceph: unlink from o_linger_requests when clearing r_osd
idryomov Nov 4, 2014
ba9d114
libceph: clear r_req_lru_item in __unregister_linger_request()
idryomov Nov 5, 2014
cc9f1f5
libceph: change from BUG to WARN for __remove_osd() asserts
idryomov Nov 5, 2014
242bcd5
net/smsc911x: Fix rare soft reset timeout issue due to PHY power-down…
akochetkov Nov 13, 2014
6ff53fd
net/smsc911x: Fix delays in the PHY enable/disable routines
akochetkov Nov 13, 2014
0c828f2
lib: rhashtable - Remove weird non-ASCII characters from comments
herbertx Nov 13, 2014
ccf899a
smsc911x: power-up phydev before doing a software reset.
Nov 13, 2014
19ca9fc
vxlan: Do not reuse sockets for a different address family
marceloleitner Nov 13, 2014
c406515
zram: avoid kunmap_atomic() of a NULL pointer
Nov 13, 2014
5842001
mm/compaction: skip the range until proper target pageblock is met
JoonsooKim Nov 13, 2014
ad53f92
mm/page_alloc: fix incorrect isolation behavior by rechecking migrate…
JoonsooKim Nov 13, 2014
51bb1a4
mm/page_alloc: add freepage on isolate pageblock to correct buddy list
JoonsooKim Nov 13, 2014
8f82b55
mm/page_alloc: move freepage counting logic to __free_one_page()
JoonsooKim Nov 13, 2014
3c60509
mm/page_alloc: restrict max order of merging on isolated pageblock
JoonsooKim Nov 13, 2014
95069ac
mm/slab: fix unalignment problem on Malta with EVA due to slab merge
JoonsooKim Nov 13, 2014
dae803e
mm: alloc_contig_range: demote pages busy message from warn to info
mina86 Nov 13, 2014
1d5bfe1
mm, compaction: prevent infinite loop in compact_zone
tehcaster Nov 13, 2014
8edc6e1
fanotify: fix notification of groups with inode & mount marks
jankara Nov 13, 2014
57cbc87
mm/debug-pagealloc: correct freepage accounting and order resetting
JoonsooKim Nov 13, 2014
f784a3f
mem-hotplug: reset node managed pages when hot-adding a new pgdat
tang-chen Nov 13, 2014
0bd8542
mem-hotplug: reset node present pages when hot-adding a new pgdat
tang-chen Nov 13, 2014
bc53a3f
kernel/panic.c: update comments for print_tainted
Nov 13, 2014
8fe671f
MAINTAINERS: add IIO include files
Nov 13, 2014
6b07974
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
torvalds Nov 14, 2014
b0ab3f1
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
torvalds Nov 14, 2014
971ad4e
Merge branch 'akpm' (fixes from Andrew Morton)
torvalds Nov 14, 2014
a7ef82a
Input: alps - ignore bad data on Dell Latitudes E6440 and E7440
pali Nov 9, 2014
f386474
Input: elantech - report the middle button of the touchpad
ulrikdb Nov 14, 2014
2d9eb81
Input: elantech - provide a sysfs knob for crc_enabled
ulrikdb Nov 14, 2014
c6c748e
Input: elantech - update the documentation
ulrikdb Nov 14, 2014
5cf5203
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
torvalds Nov 14, 2014
b23dc5a
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/gi…
torvalds Nov 14, 2014
eaca2d8
firewire: cdev: prevent kernel stack leaking into ioctl arguments
Nov 11, 2014
a9b7071
Merge branch 'acpi-blacklist'
rafaeljw Nov 14, 2014
3168949
Merge branches 'pm-domains', 'pm-sleep' and 'pm-cpufreq'
rafaeljw Nov 14, 2014
3865efc
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
torvalds Nov 14, 2014
f720d7d
Merge tag 'firewire-fix' of git://git.kernel.org/pub/scm/linux/kernel…
torvalds Nov 14, 2014
78646f6
Merge tag 'pm+acpi-3.18-rc5' of git://git.kernel.org/pub/scm/linux/ke…
torvalds Nov 14, 2014
6f0d7a9
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
torvalds Nov 14, 2014
e57c641
Merge branch 'for-3.18-fixes' of git://git.kernel.org/pub/scm/linux/k…
torvalds Nov 14, 2014
5ae9376
Merge tag 'platform-drivers-x86-v3.18-3' of git://git.infradead.org/u…
torvalds Nov 14, 2014
0861fd1
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/…
torvalds Nov 14, 2014
56c381f
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
torvalds Nov 14, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mm/page_alloc: fix incorrect isolation behavior by rechecking migrate…
…type

Before describing bugs itself, I first explain definition of freepage.

 1. pages on buddy list are counted as freepage.
 2. pages on isolate migratetype buddy list are *not* counted as freepage.
 3. pages on cma buddy list are counted as CMA freepage, too.

Now, I describe problems and related patch.

Patch 1: There is race conditions on getting pageblock migratetype that
it results in misplacement of freepages on buddy list, incorrect
freepage count and un-availability of freepage.

Patch 2: Freepages on pcp list could have stale cached information to
determine migratetype of buddy list to go.  This causes misplacement of
freepages on buddy list and incorrect freepage count.

Patch 4: Merging between freepages on different migratetype of
pageblocks will cause freepages accouting problem.  This patch fixes it.

Without patchset [3], above problem doesn't happens on my CMA allocation
test, because CMA reserved pages aren't used at all.  So there is no
chance for above race.

With patchset [3], I did simple CMA allocation test and get below
result:

 - Virtual machine, 4 cpus, 1024 MB memory, 256 MB CMA reservation
 - run kernel build (make -j16) on background
 - 30 times CMA allocation(8MB * 30 = 240MB) attempts in 5 sec interval
 - Result: more than 5000 freepage count are missed

With patchset [3] and this patchset, I found that no freepage count are
missed so that I conclude that problems are solved.

On my simple memory offlining test, these problems also occur on that
environment, too.

This patch (of 4):

There are two paths to reach core free function of buddy allocator,
__free_one_page(), one is free_one_page()->__free_one_page() and the
other is free_hot_cold_page()->free_pcppages_bulk()->__free_one_page().
Each paths has race condition causing serious problems.  At first, this
patch is focused on first type of freepath.  And then, following patch
will solve the problem in second type of freepath.

In the first type of freepath, we got migratetype of freeing page
without holding the zone lock, so it could be racy.  There are two cases
of this race.

 1. pages are added to isolate buddy list after restoring orignal
    migratetype

    CPU1                                   CPU2

    get migratetype => return MIGRATE_ISOLATE
    call free_one_page() with MIGRATE_ISOLATE

                                grab the zone lock
                                unisolate pageblock
                                release the zone lock

    grab the zone lock
    call __free_one_page() with MIGRATE_ISOLATE
    freepage go into isolate buddy list,
    although pageblock is already unisolated

This may cause two problems.  One is that we can't use this page anymore
until next isolation attempt of this pageblock, because freepage is on
isolate buddy list.  The other is that freepage accouting could be wrong
due to merging between different buddy list.  Freepages on isolate buddy
list aren't counted as freepage, but ones on normal buddy list are
counted as freepage.  If merge happens, buddy freepage on normal buddy
list is inevitably moved to isolate buddy list without any consideration
of freepage accouting so it could be incorrect.

 2. pages are added to normal buddy list while pageblock is isolated.
    It is similar with above case.

This also may cause two problems.  One is that we can't keep these
freepages from being allocated.  Although this pageblock is isolated,
freepage would be added to normal buddy list so that it could be
allocated without any restriction.  And the other problem is same as
case 1, that it, incorrect freepage accouting.

This race condition would be prevented by checking migratetype again
with holding the zone lock.  Because it is somewhat heavy operation and
it isn't needed in common case, we want to avoid rechecking as much as
possible.  So this patch introduce new variable, nr_isolate_pageblock in
struct zone to check if there is isolated pageblock.  With this, we can
avoid to re-check migratetype in common case and do it only if there is
isolated pageblock or migratetype is MIGRATE_ISOLATE.  This solve above
mentioned problems.

Changes from v3:
Add one more check in free_one_page() that checks whether migratetype is
MIGRATE_ISOLATE or not. Without this, abovementioned case 1 could happens.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Heesub Shin <heesub.shin@samsung.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Gioh Kim <gioh.kim@lge.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
JoonsooKim authored and torvalds committed Nov 14, 2014
commit ad53f92eb416d81e469fa8ea57153e59455e7175
9 changes: 9 additions & 0 deletions include/linux/mmzone.h
Original file line number Diff line number Diff line change
@@ -431,6 +431,15 @@ struct zone {
*/
int nr_migrate_reserve_block;

#ifdef CONFIG_MEMORY_ISOLATION
/*
* Number of isolated pageblock. It is used to solve incorrect
* freepage counting problem due to racy retrieving migratetype
* of pageblock. Protected by zone->lock.
*/
unsigned long nr_isolate_pageblock;
#endif

#ifdef CONFIG_MEMORY_HOTPLUG
/* see spanned/present_pages for more description */
seqlock_t span_seqlock;
8 changes: 8 additions & 0 deletions include/linux/page-isolation.h
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
#define __LINUX_PAGEISOLATION_H

#ifdef CONFIG_MEMORY_ISOLATION
static inline bool has_isolate_pageblock(struct zone *zone)
{
return zone->nr_isolate_pageblock;
}
static inline bool is_migrate_isolate_page(struct page *page)
{
return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
@@ -11,6 +15,10 @@ static inline bool is_migrate_isolate(int migratetype)
return migratetype == MIGRATE_ISOLATE;
}
#else
static inline bool has_isolate_pageblock(struct zone *zone)
{
return false;
}
static inline bool is_migrate_isolate_page(struct page *page)
{
return false;
11 changes: 9 additions & 2 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
@@ -739,9 +739,16 @@ static void free_one_page(struct zone *zone,
if (nr_scanned)
__mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);

if (unlikely(has_isolate_pageblock(zone) ||
is_migrate_isolate(migratetype))) {
migratetype = get_pfnblock_migratetype(page, pfn);
if (is_migrate_isolate(migratetype))
goto skip_counting;
}
__mod_zone_freepage_state(zone, 1 << order, migratetype);

skip_counting:
__free_one_page(page, pfn, zone, order, migratetype);
if (unlikely(!is_migrate_isolate(migratetype)))
__mod_zone_freepage_state(zone, 1 << order, migratetype);
spin_unlock(&zone->lock);
}

2 changes: 2 additions & 0 deletions mm/page_isolation.c
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages)
int migratetype = get_pageblock_migratetype(page);

set_pageblock_migratetype(page, MIGRATE_ISOLATE);
zone->nr_isolate_pageblock++;
nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE);

__mod_zone_freepage_state(zone, -nr_pages, migratetype);
@@ -83,6 +84,7 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype)
nr_pages = move_freepages_block(zone, page, migratetype);
__mod_zone_freepage_state(zone, nr_pages, migratetype);
set_pageblock_migratetype(page, migratetype);
zone->nr_isolate_pageblock--;
out:
spin_unlock_irqrestore(&zone->lock, flags);
}