From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Mel Gorman <mgorman@suse.de>,
Rik van Riel <riel@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 3.11 72/94] mm: numa: Sanitize task_numa_fault() callsites
Date: Fri, 8 Nov 2013 22:52:18 -0800 [thread overview]
Message-ID: <20131109065209.355964917@linuxfoundation.org> (raw)
In-Reply-To: <20131109065204.252462489@linuxfoundation.org>
3.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <mgorman@suse.de>
commit c61109e34f60f6e85bb43c5a1cd51c0e3db40847 upstream.
There are three callers of task_numa_fault():
- do_huge_pmd_numa_page():
Accounts against the current node, not the node where the
page resides, unless we migrated, in which case it accounts
against the node we migrated to.
- do_numa_page():
Accounts against the current node, not the node where the
page resides, unless we migrated, in which case it accounts
against the node we migrated to.
- do_pmd_numa_page():
Accounts not at all when the page isn't migrated, otherwise
accounts against the node we migrated towards.
This seems wrong to me; all three sites should have the same
sementaics, furthermore we should accounts against where the page
really is, we already know where the task is.
So modify all three sites to always account; we did after all receive
the fault; and always account to where the page is after migration,
regardless of success.
They all still differ on when they clear the PTE/PMD; ideally that
would get sorted too.
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1381141781-10992-8-git-send-email-mgorman@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/huge_memory.c | 25 +++++++++++++------------
mm/memory.c | 53 +++++++++++++++++++++--------------------------------
2 files changed, 34 insertions(+), 44 deletions(-)
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1293,18 +1293,19 @@ int do_huge_pmd_numa_page(struct mm_stru
struct anon_vma *anon_vma = NULL;
struct page *page;
unsigned long haddr = addr & HPAGE_PMD_MASK;
+ int page_nid = -1, this_nid = numa_node_id();
int target_nid;
- int current_nid = -1;
- bool migrated, page_locked;
+ bool page_locked;
+ bool migrated = false;
spin_lock(&mm->page_table_lock);
if (unlikely(!pmd_same(pmd, *pmdp)))
goto out_unlock;
page = pmd_page(pmd);
- current_nid = page_to_nid(page);
+ page_nid = page_to_nid(page);
count_vm_numa_event(NUMA_HINT_FAULTS);
- if (current_nid == numa_node_id())
+ if (page_nid == this_nid)
count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
/*
@@ -1347,19 +1348,18 @@ int do_huge_pmd_numa_page(struct mm_stru
spin_unlock(&mm->page_table_lock);
migrated = migrate_misplaced_transhuge_page(mm, vma,
pmdp, pmd, addr, page, target_nid);
- if (!migrated)
+ if (migrated)
+ page_nid = target_nid;
+ else
goto check_same;
- task_numa_fault(target_nid, HPAGE_PMD_NR, true);
- if (anon_vma)
- page_unlock_anon_vma_read(anon_vma);
- return 0;
+ goto out;
check_same:
spin_lock(&mm->page_table_lock);
if (unlikely(!pmd_same(pmd, *pmdp))) {
/* Someone else took our fault */
- current_nid = -1;
+ page_nid = -1;
goto out_unlock;
}
clear_pmdnuma:
@@ -1374,8 +1374,9 @@ out:
if (anon_vma)
page_unlock_anon_vma_read(anon_vma);
- if (current_nid != -1)
- task_numa_fault(current_nid, HPAGE_PMD_NR, false);
+ if (page_nid != -1)
+ task_numa_fault(page_nid, HPAGE_PMD_NR, migrated);
+
return 0;
}
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3532,12 +3532,12 @@ static int do_nonlinear_fault(struct mm_
}
int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
- unsigned long addr, int current_nid)
+ unsigned long addr, int page_nid)
{
get_page(page);
count_vm_numa_event(NUMA_HINT_FAULTS);
- if (current_nid == numa_node_id())
+ if (page_nid == numa_node_id())
count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
return mpol_misplaced(page, vma, addr);
@@ -3548,7 +3548,7 @@ int do_numa_page(struct mm_struct *mm, s
{
struct page *page = NULL;
spinlock_t *ptl;
- int current_nid = -1;
+ int page_nid = -1;
int target_nid;
bool migrated = false;
@@ -3578,15 +3578,10 @@ int do_numa_page(struct mm_struct *mm, s
return 0;
}
- current_nid = page_to_nid(page);
- target_nid = numa_migrate_prep(page, vma, addr, current_nid);
+ page_nid = page_to_nid(page);
+ target_nid = numa_migrate_prep(page, vma, addr, page_nid);
pte_unmap_unlock(ptep, ptl);
if (target_nid == -1) {
- /*
- * Account for the fault against the current node if it not
- * being replaced regardless of where the page is located.
- */
- current_nid = numa_node_id();
put_page(page);
goto out;
}
@@ -3594,11 +3589,11 @@ int do_numa_page(struct mm_struct *mm, s
/* Migrate to the requested node */
migrated = migrate_misplaced_page(page, target_nid);
if (migrated)
- current_nid = target_nid;
+ page_nid = target_nid;
out:
- if (current_nid != -1)
- task_numa_fault(current_nid, 1, migrated);
+ if (page_nid != -1)
+ task_numa_fault(page_nid, 1, migrated);
return 0;
}
@@ -3613,7 +3608,6 @@ static int do_pmd_numa_page(struct mm_st
unsigned long offset;
spinlock_t *ptl;
bool numa = false;
- int local_nid = numa_node_id();
spin_lock(&mm->page_table_lock);
pmd = *pmdp;
@@ -3636,9 +3630,10 @@ static int do_pmd_numa_page(struct mm_st
for (addr = _addr + offset; addr < _addr + PMD_SIZE; pte++, addr += PAGE_SIZE) {
pte_t pteval = *pte;
struct page *page;
- int curr_nid = local_nid;
+ int page_nid = -1;
int target_nid;
- bool migrated;
+ bool migrated = false;
+
if (!pte_present(pteval))
continue;
if (!pte_numa(pteval))
@@ -3660,25 +3655,19 @@ static int do_pmd_numa_page(struct mm_st
if (unlikely(page_mapcount(page) != 1))
continue;
- /*
- * Note that the NUMA fault is later accounted to either
- * the node that is currently running or where the page is
- * migrated to.
- */
- curr_nid = local_nid;
- target_nid = numa_migrate_prep(page, vma, addr,
- page_to_nid(page));
- if (target_nid == -1) {
+ page_nid = page_to_nid(page);
+ target_nid = numa_migrate_prep(page, vma, addr, page_nid);
+ pte_unmap_unlock(pte, ptl);
+ if (target_nid != -1) {
+ migrated = migrate_misplaced_page(page, target_nid);
+ if (migrated)
+ page_nid = target_nid;
+ } else {
put_page(page);
- continue;
}
- /* Migrate to the requested node */
- pte_unmap_unlock(pte, ptl);
- migrated = migrate_misplaced_page(page, target_nid);
- if (migrated)
- curr_nid = target_nid;
- task_numa_fault(curr_nid, 1, migrated);
+ if (page_nid != -1)
+ task_numa_fault(page_nid, 1, migrated);
pte = pte_offset_map_lock(mm, pmdp, addr, &ptl);
}
next prev parent reply other threads:[~2013-11-09 6:52 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-09 6:51 [PATCH 3.11 00/94] 3.11.8-stable review Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 01/94] usb: musb: start musb on the udc side, too Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 02/94] usb-storage: add quirk for mandatory READ_CAPACITY_16 Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 03/94] USB: support new huawei devices in option.c Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 04/94] USB: quirks.c: add one device that cannot deal with suspension Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 05/94] USB: quirks: add touchscreen that is dazzeled by remote wakeup Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 06/94] USB: serial: ftdi_sio: add id for Z3X Box device Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 07/94] xhci: Dont enable/disable RWE on bus suspend/resume Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 08/94] cifs: Fix inability to write files >2GB to SMB2/3 shares Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 09/94] x86: Update UV3 hub revision ID Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 10/94] cpufreq: s3c64xx: Rename index to driver_data Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 11/94] cpufreq / intel_pstate: Fix max_perf_pct on resume Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 12/94] bcache: Fixed incorrect order of arguments to bio_alloc_bioset() Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 13/94] HID: wiimote: add LEGO-wiimote VID Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 14/94] cgroup: fix to break the while loop in cgroup_attach_task() correctly Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 15/94] mac80211: correctly close cancelled scans Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 16/94] mac80211: drop spoofed packets in ad-hoc mode Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 17/94] mac80211: use sta_info_get_bss() for nl80211 tx and client probing Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 18/94] mac80211: update sta->last_rx on acked tx frames Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 19/94] mac80211: fix crash if bitrate calculation goes wrong Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 20/94] ath9k: fix tx queue scheduling after channel changes Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 21/94] cfg80211: use the correct macro to check for active monitor support Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 22/94] cfg80211: fix warning when using WEXT for IBSS Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 23/94] mwifiex: fix SDIO interrupt lost issue Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 24/94] rtlwifi: rtl8192cu: Fix error in pointer arithmetic Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 25/94] iwlwifi: mvm: call ieee80211_scan_completed when needed Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 26/94] iwlwifi: pcie: add SKUs for 6000, 6005 and 6235 series Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 27/94] jfs: fix error path in ialloc Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 28/94] can: at91-can: fix device to driver data mapping for platform devices Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 29/94] can: flexcan: fix mx28 detection by rearanging OF match table Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 30/94] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 31/94] SCSI: BusLogic: Fix an oops when intializing multimaster adapter Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 32/94] SCSI: sd: call blk_pm_runtime_init before add_disk Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 33/94] ecryptfs: Fix memory leakage in keystore.c Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 34/94] eCryptfs: fix 32 bit corruption issue Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 35/94] raid5: set bio bi_vcnt 0 for discard request Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 36/94] raid5: avoid finding "discard" stripe Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 37/94] libata: make ata_eh_qc_retry() bump scmd->allowed on bogus failures Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 38/94] Revert "rt2x00pci: Use PCI MSIs whenever possible" Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 39/94] Revert "epoll: use freezable blocking call" Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 40/94] Revert "select: " Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 41/94] md: avoid deadlock when md_set_badblocks Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 42/94] md: Fix skipping recovery for read-only arrays Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 43/94] target: Fix assignment of LUN in tracepoints Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 44/94] target/pscsi: fix return value check Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 45/94] vhost/scsi: Fix incorrect usage of get_user_pages_fast write parameter Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 46/94] clockevents: Sanitize ticks to nsec conversion Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 47/94] parisc: Do not crash 64bit SMP kernels on machines with >= 4GB RAM Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 48/94] scripts/kallsyms: filter symbols not in kernel address space Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 49/94] ARC: Incorrect mm reference used in vmalloc fault handler Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 50/94] ALSA: hda - Add missing initial vmaster hook at build_controls callback Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 51/94] ALSA: hda - Fix unbalanced runtime PM refcount after S3/S4 Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 52/94] ALSA: hda - Add a fixup for ASUS N76VZ Greg Kroah-Hartman
2013-11-09 6:51 ` [PATCH 3.11 53/94] ALSA: fix oops in snd_pcm_info() caused by ASoC DPCM Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 54/94] ASoC: wm_hubs: Add missing break in hp_supply_event() Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 55/94] ASoC: dapm: Fix source list debugfs outputs Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 56/94] staging: ozwpan: prevent overflow in oz_cdev_write() Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 57/94] Staging: bcm: info leak in ioctl Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 58/94] Staging: sb105x: info leak in mp_get_count() Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 59/94] staging: wlags49_h2: buffer overflow setting station name Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 60/94] uml: check length in exitcode_proc_write() Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 61/94] xtensa: dont use alternate signal stack on threads Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 62/94] mm: make generic_access_phys available for modules Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 63/94] uio: provide vm access to UIO_MEM_PHYS maps Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 65/94] lib/scatterlist.c: dont flush_kernel_dcache_page on slab page Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 66/94] aacraid: missing capable() check in compat ioctl Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 67/94] clk: fixup argument order when setting VCO parameters Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 68/94] clk: nomadik: set all timers to use 2.4 MHz TIMCLK Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 69/94] mm: numa: Do not account for a hinting fault if we raced Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 70/94] mm: Wait for THP migrations to complete during NUMA hinting faults Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 71/94] mm: Prevent parallel splits during THP migration Greg Kroah-Hartman
2013-11-09 6:52 ` Greg Kroah-Hartman [this message]
2013-11-09 6:52 ` [PATCH 3.11 73/94] mm: Close races between THP migration and PMD numa clearing Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 74/94] mm: Account for a THP NUMA hinting update as one PTE update Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 75/94] mm: /proc/pid/pagemap: inspect _PAGE_SOFT_DIRTY only on present pages Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 76/94] mm/pagewalk.c: fix walk_page_range() access of wrong PTEs Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 77/94] drm/vmwgfx: Dont put resources with invalid ids on lru list Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 78/94] drm/vmwgfx: Dont kill clients on VT switch Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 79/94] drm/i915: split aux_clock_divider logic in a separated function for reuse Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 80/94] drm/i915: Retry DP aux_ch communications with a different clock after failure Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 81/94] drm: Prevent overwriting from userspace underallocating core ioctl structs Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 82/94] drm: Pad drm_mode_get_connector to 64-bit boundary Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 83/94] drm/radeon/atom: workaround vbios bug in transmitter table on rs780 Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 84/94] drm/radeon: make missing smc ucode non-fatal (r7xx-SI) Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 85/94] drm/i915: Add HSW CRT output readout support Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 86/94] drm/i915: Add support for pipe_bpp readout Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 87/94] drm/i915: No LVDS hardware on Intel D410PT and D425KT Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 88/94] drm/i915: Fix the PPT fdi lane bifurcate state handling on ivb Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 89/94] mutex: Avoid gcc version dependent __builtin_constant_p() usage Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 90/94] seq_file: always update file->f_pos in seq_lseek() Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 91/94] NTB: Add Error Handling in ntb_device_setup Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 92/94] NTB: Correct Number of Scratch Pad Registers Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 93/94] NTB: Correct USD/DSD Identification Greg Kroah-Hartman
2013-11-09 6:52 ` [PATCH 3.11 94/94] NTB: Correct debugfs to work with more than 1 NTB Device Greg Kroah-Hartman
2013-11-09 17:00 ` [PATCH 3.11 00/94] 3.11.8-stable review Guenter Roeck
2013-11-09 17:12 ` Greg Kroah-Hartman
2013-11-10 12:11 ` Satoru Takeuchi
2013-11-10 15:15 ` Greg Kroah-Hartman
2013-11-11 17:57 ` Shuah Khan
2013-11-11 22:51 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131109065209.355964917@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=aarcange@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).