summaryrefslogtreecommitdiff
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2018-03-29 11:37:54 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2018-03-29 11:37:54 +0200
commit38f41ec1cb31ccf5d2a39dfc255cc522de3b320e (patch)
tree4bcd97b9fb900f71a33b66789e20e1cf354b70b2 /arch/x86/mm
parent49632c6d98736c5c0890c3cf081dcf02566c456a (diff)
parentaec8e72ebde913a205f5c466d718bd5fe14ab440 (diff)
Merge 4.4.125 into android-4.4
Changes in 4.4.125 MIPS: ralink: Remove ralink_halt() iio: st_pressure: st_accel: pass correct platform data to init ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit ALSA: aloop: Sync stale timer before release ALSA: aloop: Fix access to not-yet-ready substream via cable ALSA: hda/realtek - Always immediately update mute LED with pin VREF mmc: dw_mmc: fix falling from idmac to PIO mode when dw_mci_reset occurs PCI: Add function 1 DMA alias quirk for Highpoint RocketRAID 644L ahci: Add PCI-id for the Highpoint Rocketraid 644L card clk: bcm2835: Protect sections updating shared registers Bluetooth: btusb: Fix quirk for Atheros 1525/QCA6174 libata: fix length validation of ATAPI-relayed SCSI commands libata: remove WARN() for DMA or PIO command without data libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs libata: disable LPM for Crucial BX100 SSD 500GB drive libata: Enable queued TRIM for Samsung SSD 860 libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions libata: Modify quirks for MX100 to limit NCQ_TRIM quirk to MU01 version mm/vmalloc: add interfaces to free unmapped page table x86/mm: implement free pmd/pte page interfaces drm/vmwgfx: Fix a destoy-while-held mutex problem. drm/radeon: Don't turn off DP sink when disconnected drm: udl: Properly check framebuffer mmap offsets acpi, numa: fix pxm to online numa node associations brcmfmac: fix P2P_DEVICE ethernet address generation rtlwifi: rtl8723be: Fix loss of signal tracing: probeevent: Fix to support minus offset from symbol mtd: nand: fsl_ifc: Fix nand waitfunc return value staging: ncpfs: memory corruption in ncp_read_kernel() can: cc770: Fix stalls on rt-linux, remove redundant IRQ ack can: cc770: Fix queue stall & dropped RTR reply can: cc770: Fix use after free in cc770_tx_interrupt() tty: vt: fix up tabstops properly kvm/x86: fix icebp instruction handling x86/build/64: Force the linker to use 2MB page size x86/boot/64: Verify alignment of the LOAD segment x86/entry/64: Don't use IST entry for #BP stack perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period() staging: lustre: ptlrpc: kfree used instead of kvfree kbuild: disable clang's default use of -fmerge-all-constants bpf: skip unnecessary capability check bpf, x64: increase number of passes Linux 4.4.125 Change-Id: I14b307cd27ff088800174c74819a3ff1790b41ce Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/pgtable.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index dbc27a2b4ad5..c013326a0d7a 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -666,4 +666,52 @@ int pmd_clear_huge(pmd_t *pmd)
return 0;
}
+
+/**
+ * pud_free_pmd_page - Clear pud entry and free pmd page.
+ * @pud: Pointer to a PUD.
+ *
+ * Context: The pud range has been unmaped and TLB purged.
+ * Return: 1 if clearing the entry succeeded. 0 otherwise.
+ */
+int pud_free_pmd_page(pud_t *pud)
+{
+ pmd_t *pmd;
+ int i;
+
+ if (pud_none(*pud))
+ return 1;
+
+ pmd = (pmd_t *)pud_page_vaddr(*pud);
+
+ for (i = 0; i < PTRS_PER_PMD; i++)
+ if (!pmd_free_pte_page(&pmd[i]))
+ return 0;
+
+ pud_clear(pud);
+ free_page((unsigned long)pmd);
+
+ return 1;
+}
+
+/**
+ * pmd_free_pte_page - Clear pmd entry and free pte page.
+ * @pmd: Pointer to a PMD.
+ *
+ * Context: The pmd range has been unmaped and TLB purged.
+ * Return: 1 if clearing the entry succeeded. 0 otherwise.
+ */
+int pmd_free_pte_page(pmd_t *pmd)
+{
+ pte_t *pte;
+
+ if (pmd_none(*pmd))
+ return 1;
+
+ pte = (pte_t *)pmd_page_vaddr(*pmd);
+ pmd_clear(pmd);
+ free_page((unsigned long)pte);
+
+ return 1;
+}
#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */