[PATCH 1/4] mailbox/omap: store mailbox interrupt type in omap_mbox_device

2016-04-06 Thread Suman Anna
The interrupt type used for identifying the layout of the interrupt configuration registers between OMAP4+ SoCs and older SoCs is stored only in the sub-mailbox structures for easier access. Store this type in the the omap_mbox_device structure as well along with the other global variables. This

Re: [PATCH v2 2/5] string_helpers: add kstrdup_quotable_cmdline

2016-04-06 Thread Kees Cook
On Wed, Mar 30, 2016 at 4:11 AM, Andy Shevchenko wrote: > On Wed, 2016-03-30 at 14:07 +0300, Andy Shevchenko wrote: >> On Mon, 2016-03-28 at 14:14 -0700, Kees Cook wrote: > > >> > + res = get_cmdline(task, buffer, PAGE_SIZE - 1); >> > + buffer[res] = '\0'; >> > + >> > + /* Collapse trailing

[PATCH 3/4] mailbox/omap: check for any unread messages during suspend

2016-04-06 Thread Suman Anna
The OMAP mailbox driver is used by clients to communicate with remote processors in general. The mailbox clients are expected to have stopped communicating with these remote processors during a system suspend. The OMAP mailbox fifos are expected to not have any messages as such. Add a check for

[PATCH 3/4] mailbox/omap: check for any unread messages during suspend

2016-04-06 Thread Suman Anna
The OMAP mailbox driver is used by clients to communicate with remote processors in general. The mailbox clients are expected to have stopped communicating with these remote processors during a system suspend. The OMAP mailbox fifos are expected to not have any messages as such. Add a check for

[PATCH 4/4] mailbox/omap: kill omap_mbox_{save/restore}_ctx() functions

2016-04-06 Thread Suman Anna
The omap_mbox_save_ctx() and omap_mbox_restore_ctx() API were previously provided to OMAP mailbox clients to save and restore the mailbox context during system suspend/resume. The save and restore functionality is now implemented through System PM driver callbacks, and there is no need for these

[PATCH 0/4] OMAP mailbox suspend/resume support

2016-04-06 Thread Suman Anna
Hi, The following series adds the suspend/resume support through the PM callbacks to the OMAP mailbox driver. The functionality is added mainly in Patch 2. Patch 4 kills the legacy API exported to the mailbox clients to save and restore the context. The series is based on 4.6-rc2 + the OMAP

[PATCH 0/4] OMAP mailbox suspend/resume support

2016-04-06 Thread Suman Anna
Hi, The following series adds the suspend/resume support through the PM callbacks to the OMAP mailbox driver. The functionality is added mainly in Patch 2. Patch 4 kills the legacy API exported to the mailbox clients to save and restore the context. The series is based on 4.6-rc2 + the OMAP

[PATCH 4/4] mailbox/omap: kill omap_mbox_{save/restore}_ctx() functions

2016-04-06 Thread Suman Anna
The omap_mbox_save_ctx() and omap_mbox_restore_ctx() API were previously provided to OMAP mailbox clients to save and restore the mailbox context during system suspend/resume. The save and restore functionality is now implemented through System PM driver callbacks, and there is no need for these

[PATCH 2/4] mailbox/omap: add support for suspend/resume

2016-04-06 Thread Suman Anna
Support has been added to the OMAP mailbox driver to allow it to work across a system suspend/resume. The OMAP mailbox driver requires only the interrupt configuration registers to be saved and restored, and this is done in the suspend/resume callbacks. The registers need to be saved only if there

[PATCH 2/4] mailbox/omap: add support for suspend/resume

2016-04-06 Thread Suman Anna
Support has been added to the OMAP mailbox driver to allow it to work across a system suspend/resume. The OMAP mailbox driver requires only the interrupt configuration registers to be saved and restored, and this is done in the suspend/resume callbacks. The registers need to be saved only if there

Re: [PATCH 00/12] mtd: get rid of of_mtd.{c,h} and of_get_nand_xx()

2016-04-06 Thread Franklin S Cooper Jr.
On 04/01/2016 07:54 AM, Boris Brezillon wrote: > Hello, > > of_mtd.{h,c} are providing the of_get_nand_xxx() helpers to help NAND > controller drivers parse some generic NAND DT properties. > An infrastructure has recently been added to NAND core to automatically > parse those properties when

Re: [PATCH 00/12] mtd: get rid of of_mtd.{c,h} and of_get_nand_xx()

2016-04-06 Thread Franklin S Cooper Jr.
On 04/01/2016 07:54 AM, Boris Brezillon wrote: > Hello, > > of_mtd.{h,c} are providing the of_get_nand_xxx() helpers to help NAND > controller drivers parse some generic NAND DT properties. > An infrastructure has recently been added to NAND core to automatically > parse those properties when

Re: [PATCH] cpufreq: intel_pstate: Documenation for structures

2016-04-06 Thread Rafael J. Wysocki
On Sunday, April 03, 2016 01:06:46 PM Srinivas Pandruvada wrote: > No code change. Only added kernel doc style comments for structures. > > Signed-off-by: Srinivas Pandruvada Applied, thanks!

Re: [PATCH] cpufreq: intel_pstate: Documenation for structures

2016-04-06 Thread Rafael J. Wysocki
On Sunday, April 03, 2016 01:06:46 PM Srinivas Pandruvada wrote: > No code change. Only added kernel doc style comments for structures. > > Signed-off-by: Srinivas Pandruvada Applied, thanks!

Re: [PATCH] powercap: intel_rapl: Add missing Haswell model

2016-04-06 Thread Rafael J. Wysocki
On Saturday, March 26, 2016 05:03:38 AM Srinivas Pandruvada wrote: > Added missing model 0x46. > > Tested-and-reported-by: Piotr Maksymiuk > Signed-off-by: Srinivas Pandruvada > --- > drivers/powercap/intel_rapl.c | 1 + > 1

Re: [PATCH] powercap: intel_rapl: Add missing Haswell model

2016-04-06 Thread Rafael J. Wysocki
On Saturday, March 26, 2016 05:03:38 AM Srinivas Pandruvada wrote: > Added missing model 0x46. > > Tested-and-reported-by: Piotr Maksymiuk > Signed-off-by: Srinivas Pandruvada > --- > drivers/powercap/intel_rapl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git

Re: [PATCH v2] PM / runtime: Document steps for device removal

2016-04-06 Thread Rafael J. Wysocki
On Sunday, April 03, 2016 02:27:27 PM Alan Stern wrote: > On Sun, 3 Apr 2016, Krzysztof Kozlowski wrote: > > > Put a reminder that during device removal drivers should revert all PM > > runtime changes from the probe. > > > > Signed-off-by: Krzysztof Kozlowski > > > > --- > >

Re: [PATCH v2] PM / runtime: Document steps for device removal

2016-04-06 Thread Rafael J. Wysocki
On Sunday, April 03, 2016 02:27:27 PM Alan Stern wrote: > On Sun, 3 Apr 2016, Krzysztof Kozlowski wrote: > > > Put a reminder that during device removal drivers should revert all PM > > runtime changes from the probe. > > > > Signed-off-by: Krzysztof Kozlowski > > > > --- > > > > Changes

Re: [PATCH] cpufreq: dt: Drop stale comment

2016-04-06 Thread Rafael J. Wysocki
On Thursday, March 24, 2016 09:51:57 AM Viresh Kumar wrote: > The comment in file header doesn't hold true anymore, drop it. > > Signed-off-by: Viresh Kumar > --- > drivers/cpufreq/cpufreq-dt.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git

Re: [PATCH] cpufreq: dt: Drop stale comment

2016-04-06 Thread Rafael J. Wysocki
On Thursday, March 24, 2016 09:51:57 AM Viresh Kumar wrote: > The comment in file header doesn't hold true anymore, drop it. > > Signed-off-by: Viresh Kumar > --- > drivers/cpufreq/cpufreq-dt.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq-dt.c

[PULL] lkdtm update (4.6-rc3)

2016-04-06 Thread Kees Cook
Hi Greg, Please pull these lkdtm changes for 4.6-rc3. (BTW, should I send these lkdtm pulls to you, or to Linus?) Thanks! -Kees The following changes since commit c4004b02f8e5b9ce357a0bb1641756cc86962664: x86: remove the kernel code/data/bss resources from /proc/iomem (2016-04-06 13:45:07

[PULL] lkdtm update (4.6-rc3)

2016-04-06 Thread Kees Cook
Hi Greg, Please pull these lkdtm changes for 4.6-rc3. (BTW, should I send these lkdtm pulls to you, or to Linus?) Thanks! -Kees The following changes since commit c4004b02f8e5b9ce357a0bb1641756cc86962664: x86: remove the kernel code/data/bss resources from /proc/iomem (2016-04-06 13:45:07

Re: [PATCH] staging: rts5208: alignment to match open paranthesis

2016-04-06 Thread Greg KH
On Wed, Apr 06, 2016 at 02:41:01PM -0700, Manav Batra wrote: > Fixes CHECK: Alignment should match open parenthesis > > Is the subject and patch fine? > Sorry, just getting used to the process, and thanks. Yes, this is better, but please resend without these two lines in here, you don't want

Re: [PATCH] staging: rts5208: alignment to match open paranthesis

2016-04-06 Thread Greg KH
On Wed, Apr 06, 2016 at 02:41:01PM -0700, Manav Batra wrote: > Fixes CHECK: Alignment should match open parenthesis > > Is the subject and patch fine? > Sorry, just getting used to the process, and thanks. Yes, this is better, but please resend without these two lines in here, you don't want

Re: [PATCH v6 0/7] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 1/3: iommu changes

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:06:55 + Eric Auger wrote: > This series introduces the dma-reserved-iommu api used to: > - create/destroy an iova domain dedicated to reserved iova bindings > - map/unmap physical addresses onto reserved IOVAs. > - unmap and destroy all IOVA

Re: [PATCH v6 0/7] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 1/3: iommu changes

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:06:55 + Eric Auger wrote: > This series introduces the dma-reserved-iommu api used to: > - create/destroy an iova domain dedicated to reserved iova bindings > - map/unmap physical addresses onto reserved IOVAs. > - unmap and destroy all IOVA reserved bindings Why are

Re: [PATCH] ARM: dts: r8a7791: Don't disable referenced optional clocks

2016-04-06 Thread Sergei Shtylyov
On 04/06/2016 03:52 PM, Sjoerd Simons wrote: clk_get on a disabled clock node will return EPROBE_DEFER, which can cause drivers to be deferred forever if such clocks are referenced in their clocks property. Update the various disabled external clock nodes to default to a frequency of 0, but

Re: [PATCH] ARM: dts: r8a7791: Don't disable referenced optional clocks

2016-04-06 Thread Sergei Shtylyov
On 04/06/2016 03:52 PM, Sjoerd Simons wrote: clk_get on a disabled clock node will return EPROBE_DEFER, which can cause drivers to be deferred forever if such clocks are referenced in their clocks property. Update the various disabled external clock nodes to default to a frequency of 0, but

[PATCH 1/3] ia64: remove unused asm/segment.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/segment.h contains only a comment that it is still in the source tree as it may be referenced from some files. Actually only 2 files that are not in an arch/* directory include . The first is

[PATCH 1/3] ia64: remove unused asm/segment.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/segment.h contains only a comment that it is still in the source tree as it may be referenced from some files. Actually only 2 files that are not in an arch/* directory include . The first is drivers/lguest/x86/switcher_32.S and obviously is

[PATCH 3/3] ia64: remove unused asm/mc146818rtc.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/mc146818rtc.h is not used anymore. It would be included by include/linuxmc146818rtc.h which in fact is included by the following files: * sound/core/rtctimer.c: depends on SND_RTCTIMER -> RTC

[PATCH 3/3] ia64: remove unused asm/mc146818rtc.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/mc146818rtc.h is not used anymore. It would be included by include/linuxmc146818rtc.h which in fact is included by the following files: * sound/core/rtctimer.c: depends on SND_RTCTIMER -> RTC -> !IA64 * drivers/char/nvram.c:

Boot failure when using NFS on OMAP based evms

2016-04-06 Thread Franklin S Cooper Jr.
Hi All, Currently linux-next is failing to boot via NFS on my AM335x GP evm, AM437x GP evm and Beagle X15. I bisected the problem down to the commit "udp: remove headers from UDP packets before queueing". I had to revert the following three commits to get things working again:

[PATCH 0/3] ia64: remove unused header files

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein This patchset removes three unreferenced and unused header files of the ia64 architecture. Also some #include directives would resolve to the files I propose for removal, the dependencies defined by kconfig for those files do not

[PATCH 2/3] ia64: remove unused asm/idle.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/idle.h can not be included by any file and as a consequence may be removed from the source tree. Currently five files have #includes for asm/idle.h: drivers/cpufreq/loongson2_cpufreq.c:

Boot failure when using NFS on OMAP based evms

2016-04-06 Thread Franklin S Cooper Jr.
Hi All, Currently linux-next is failing to boot via NFS on my AM335x GP evm, AM437x GP evm and Beagle X15. I bisected the problem down to the commit "udp: remove headers from UDP packets before queueing". I had to revert the following three commits to get things working again:

[PATCH 0/3] ia64: remove unused header files

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein This patchset removes three unreferenced and unused header files of the ia64 architecture. Also some #include directives would resolve to the files I propose for removal, the dependencies defined by kconfig for those files do not allow their usage together with ia64. I

[PATCH 2/3] ia64: remove unused asm/idle.h

2016-04-06 Thread Jonas Rabenstein
From: Jonas Rabenstein The file arch/ia64/include/asm/idle.h can not be included by any file and as a consequence may be removed from the source tree. Currently five files have #includes for asm/idle.h: drivers/cpufreq/loongson2_cpufreq.c: depends on LOONGSON2 (mips)

Re: [PATCH v6 6/7] dma-reserved-iommu: iommu_get/put_single_reserved

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:07:01 + Eric Auger wrote: > This patch introduces iommu_get/put_single_reserved. > > iommu_get_single_reserved allows to allocate a new reserved iova page > and map it onto the physical page that contains a given physical address. > Page size is

Re: [PATCH v6 6/7] dma-reserved-iommu: iommu_get/put_single_reserved

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:07:01 + Eric Auger wrote: > This patch introduces iommu_get/put_single_reserved. > > iommu_get_single_reserved allows to allocate a new reserved iova page > and map it onto the physical page that contains a given physical address. > Page size is the IOMMU page one. It

Re: [PATCH v3 1/5] Documentation: DT: vdma: Rename vdma-chan prefix to dma-chan

2016-04-06 Thread Sören Brinkmann
On Wed, 2016-04-06 at 22:13:59 +, Koul, Vinod wrote: > On Wed, 2016-04-06 at 23:16 +0200, Lars-Peter Clausen wrote: > > On 04/06/2016 06:25 PM, Appana Durga Kedareswara Rao wrote: > > > a/Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt > > > > > +++ > > > > >

[PATCHv6 02/30] mm: do not pass mm_struct into handle_mm_fault

2016-04-06 Thread Kirill A. Shutemov
We always have vma->vm_mm around. Signed-off-by: Kirill A. Shutemov --- arch/alpha/mm/fault.c | 2 +- arch/arc/mm/fault.c | 2 +- arch/arm/mm/fault.c | 2 +- arch/arm64/mm/fault.c | 2 +- arch/avr32/mm/fault.c | 2

Re: [PATCH v3 1/5] Documentation: DT: vdma: Rename vdma-chan prefix to dma-chan

2016-04-06 Thread Sören Brinkmann
On Wed, 2016-04-06 at 22:13:59 +, Koul, Vinod wrote: > On Wed, 2016-04-06 at 23:16 +0200, Lars-Peter Clausen wrote: > > On 04/06/2016 06:25 PM, Appana Durga Kedareswara Rao wrote: > > > a/Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt > > > > > +++ > > > > >

[PATCHv6 02/30] mm: do not pass mm_struct into handle_mm_fault

2016-04-06 Thread Kirill A. Shutemov
We always have vma->vm_mm around. Signed-off-by: Kirill A. Shutemov --- arch/alpha/mm/fault.c | 2 +- arch/arc/mm/fault.c | 2 +- arch/arm/mm/fault.c | 2 +- arch/arm64/mm/fault.c | 2 +- arch/avr32/mm/fault.c | 2 +- arch/cris/mm/fault.c

[PATCHv6 10/30] thp: handle file COW faults

2016-04-06 Thread Kirill A. Shutemov
File COW for THP is handled on pte level: just split the pmd. It's not clear how benefitial would be allocation of huge pages on COW faults. And it would require some code to make them work. I think at some point we can consider teaching khugepaged to collapse pages in COW mappings, but

Re: [PATCH v6 4/7] dma-reserved-iommu: alloc/free_reserved_iova_domain

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:06:59 + Eric Auger wrote: > Introduce alloc/free_reserved_iova_domain in the IOMMU API. > alloc_reserved_iova_domain initializes an iova domain at a given > iova base address and with a given size. This iova domain will > be used to allocate iova

[PATCHv6 04/30] mm: postpone page table allocation until we have page to map

2016-04-06 Thread Kirill A. Shutemov
The idea (and most of code) is borrowed again: from Hugh's patchset on huge tmpfs[1]. Instead of allocation pte page table upfront, we postpone this until we have page to map in hands. This approach opens possibility to map the page as huge if filesystem supports this. Comparing to Hugh's patch

[PATCHv6 14/30] thp: run vma_adjust_trans_huge() outside i_mmap_rwsem

2016-04-06 Thread Kirill A. Shutemov
vma_addjust_trans_huge() splits pmd if it's crossing VMA boundary. During split we munlock the huge page which requires rmap walk. rmap wants to take the lock on its own. Let's move vma_adjust_trans_huge() outside i_mmap_rwsem to fix this. Signed-off-by: Kirill A. Shutemov

[PATCHv6 10/30] thp: handle file COW faults

2016-04-06 Thread Kirill A. Shutemov
File COW for THP is handled on pte level: just split the pmd. It's not clear how benefitial would be allocation of huge pages on COW faults. And it would require some code to make them work. I think at some point we can consider teaching khugepaged to collapse pages in COW mappings, but

Re: [PATCH v6 4/7] dma-reserved-iommu: alloc/free_reserved_iova_domain

2016-04-06 Thread Alex Williamson
On Mon, 4 Apr 2016 08:06:59 + Eric Auger wrote: > Introduce alloc/free_reserved_iova_domain in the IOMMU API. > alloc_reserved_iova_domain initializes an iova domain at a given > iova base address and with a given size. This iova domain will > be used to allocate iova within that window.

[PATCHv6 04/30] mm: postpone page table allocation until we have page to map

2016-04-06 Thread Kirill A. Shutemov
The idea (and most of code) is borrowed again: from Hugh's patchset on huge tmpfs[1]. Instead of allocation pte page table upfront, we postpone this until we have page to map in hands. This approach opens possibility to map the page as huge if filesystem supports this. Comparing to Hugh's patch

[PATCHv6 14/30] thp: run vma_adjust_trans_huge() outside i_mmap_rwsem

2016-04-06 Thread Kirill A. Shutemov
vma_addjust_trans_huge() splits pmd if it's crossing VMA boundary. During split we munlock the huge page which requires rmap walk. rmap wants to take the lock on its own. Let's move vma_adjust_trans_huge() outside i_mmap_rwsem to fix this. Signed-off-by: Kirill A. Shutemov --- mm/mmap.c | 4

[PATCHv6 03/30] mm: introduce fault_env

2016-04-06 Thread Kirill A. Shutemov
The idea borrowed from Peter's patch from patchset on speculative page faults[1]: Instead of passing around the endless list of function arguments, replace the lot with a single structure so we can change context without endless function signature changes. The changes are mostly mechanical with

[PATCHv6 08/30] thp: support file pages in zap_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
split_huge_pmd() for file mappings (and DAX too) is implemented by just clearing pmd entry as we can re-fill this area from page cache on pte level later. This means we don't need deposit page tables when file THP is mapped. Therefore we shouldn't try to withdraw a page table on zap_huge_pmd()

[PATCHv6 01/30] thp, mlock: update unevictable-lru.txt

2016-04-06 Thread Kirill A. Shutemov
Add description of THP handling into unevictable-lru.txt. Signed-off-by: Kirill A. Shutemov --- Documentation/vm/unevictable-lru.txt | 21 + 1 file changed, 21 insertions(+) diff --git a/Documentation/vm/unevictable-lru.txt

[PATCHv6 12/30] thp: skip file huge pmd on copy_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
copy_page_range() has a check for "Don't copy ptes where a page fault will fill them correctly." It works on VMA level. We still copy all page table entries from private mappings, even if they map page cache. We can simplify copy_huge_pmd() a bit by skipping file PMDs. We don't map file private

[PATCHv6 01/30] thp, mlock: update unevictable-lru.txt

2016-04-06 Thread Kirill A. Shutemov
Add description of THP handling into unevictable-lru.txt. Signed-off-by: Kirill A. Shutemov --- Documentation/vm/unevictable-lru.txt | 21 + 1 file changed, 21 insertions(+) diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt index

[PATCHv6 12/30] thp: skip file huge pmd on copy_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
copy_page_range() has a check for "Don't copy ptes where a page fault will fill them correctly." It works on VMA level. We still copy all page table entries from private mappings, even if they map page cache. We can simplify copy_huge_pmd() a bit by skipping file PMDs. We don't map file private

[PATCHv6 03/30] mm: introduce fault_env

2016-04-06 Thread Kirill A. Shutemov
The idea borrowed from Peter's patch from patchset on speculative page faults[1]: Instead of passing around the endless list of function arguments, replace the lot with a single structure so we can change context without endless function signature changes. The changes are mostly mechanical with

[PATCHv6 08/30] thp: support file pages in zap_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
split_huge_pmd() for file mappings (and DAX too) is implemented by just clearing pmd entry as we can re-fill this area from page cache on pte level later. This means we don't need deposit page tables when file THP is mapped. Therefore we shouldn't try to withdraw a page table on zap_huge_pmd()

[PATCHv6 09/30] thp: handle file pages in split_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
Splitting THP PMD is simple: just unmap it as in DAX case. Unlike DAX, we also remove the page from rmap and drop reference. Signed-off-by: Kirill A. Shutemov --- mm/huge_memory.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git

[PATCHv6 27/30] thp: update Documentation/vm/transhuge.txt

2016-04-06 Thread Kirill A. Shutemov
Add info about tmpfs/shmem with huge pages. Signed-off-by: Kirill A. Shutemov --- Documentation/vm/transhuge.txt | 130 + 1 file changed, 93 insertions(+), 37 deletions(-) diff --git a/Documentation/vm/transhuge.txt

[PATCHv6 09/30] thp: handle file pages in split_huge_pmd()

2016-04-06 Thread Kirill A. Shutemov
Splitting THP PMD is simple: just unmap it as in DAX case. Unlike DAX, we also remove the page from rmap and drop reference. Signed-off-by: Kirill A. Shutemov --- mm/huge_memory.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c

[PATCHv6 27/30] thp: update Documentation/vm/transhuge.txt

2016-04-06 Thread Kirill A. Shutemov
Add info about tmpfs/shmem with huge pages. Signed-off-by: Kirill A. Shutemov --- Documentation/vm/transhuge.txt | 130 + 1 file changed, 93 insertions(+), 37 deletions(-) diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt index

[PATCHv6 07/30] thp, vmstats: add counters for huge file pages

2016-04-06 Thread Kirill A. Shutemov
THP_FILE_ALLOC: how many times huge page was allocated and put page cache. THP_FILE_MAPPED: how many times file huge page was mapped. Signed-off-by: Kirill A. Shutemov --- include/linux/vm_event_item.h | 7 +++ mm/memory.c | 1 +

[PATCHv6 05/30] rmap: support file thp

2016-04-06 Thread Kirill A. Shutemov
Naive approach: on mapping/unmapping the page as compound we update ->_mapcount on each 4k page. That's not efficient, but it's not obvious how we can optimize this. We can look into optimization later. PG_double_map optimization doesn't work for file pages since lifecycle of file pages is

[PATCHv6 06/30] mm: introduce do_set_pmd()

2016-04-06 Thread Kirill A. Shutemov
With postponed page table allocation we have chance to setup huge pages. do_set_pte() calls do_set_pmd() if following criteria met: - page is compound; - pmd entry in pmd_none(); - vma has suitable size and alignment; Signed-off-by: Kirill A. Shutemov ---

[PATCHv6 22/30] mm, rmap: account shmem thp pages

2016-04-06 Thread Kirill A. Shutemov
Let's add ShmemHugePages and ShmemPmdMapped fields into meminfo and smaps. It indicates how many times we allocate and map shmem THP. NR_ANON_TRANSPARENT_HUGEPAGES is renamed to NR_ANON_THPS. Signed-off-by: Kirill A. Shutemov --- drivers/base/node.c| 13

[PATCHv6 05/30] rmap: support file thp

2016-04-06 Thread Kirill A. Shutemov
Naive approach: on mapping/unmapping the page as compound we update ->_mapcount on each 4k page. That's not efficient, but it's not obvious how we can optimize this. We can look into optimization later. PG_double_map optimization doesn't work for file pages since lifecycle of file pages is

[PATCHv6 06/30] mm: introduce do_set_pmd()

2016-04-06 Thread Kirill A. Shutemov
With postponed page table allocation we have chance to setup huge pages. do_set_pte() calls do_set_pmd() if following criteria met: - page is compound; - pmd entry in pmd_none(); - vma has suitable size and alignment; Signed-off-by: Kirill A. Shutemov --- include/linux/huge_mm.h | 2 ++

[PATCHv6 22/30] mm, rmap: account shmem thp pages

2016-04-06 Thread Kirill A. Shutemov
Let's add ShmemHugePages and ShmemPmdMapped fields into meminfo and smaps. It indicates how many times we allocate and map shmem THP. NR_ANON_TRANSPARENT_HUGEPAGES is renamed to NR_ANON_THPS. Signed-off-by: Kirill A. Shutemov --- drivers/base/node.c| 13 + fs/proc/meminfo.c

[PATCHv6 07/30] thp, vmstats: add counters for huge file pages

2016-04-06 Thread Kirill A. Shutemov
THP_FILE_ALLOC: how many times huge page was allocated and put page cache. THP_FILE_MAPPED: how many times file huge page was mapped. Signed-off-by: Kirill A. Shutemov --- include/linux/vm_event_item.h | 7 +++ mm/memory.c | 1 + mm/vmstat.c | 2 ++ 3

[PATCHv6 18/30] page-flags: relax policy for PG_mappedtodisk and PG_reclaim

2016-04-06 Thread Kirill A. Shutemov
These flags are in use for file THP. Signed-off-by: Kirill A. Shutemov --- include/linux/page-flags.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index

[PATCHv6 15/30] thp: file pages support for split_huge_page()

2016-04-06 Thread Kirill A. Shutemov
Basic scheme is the same as for anon THP. Main differences: - File pages are on radix-tree, so we have head->_count offset by HPAGE_PMD_NR. The count got distributed to small pages during split. - mapping->tree_lock prevents non-lockless access to pages under split over radix-tree;

[PATCHv6 25/30] shmem: add huge pages support

2016-04-06 Thread Kirill A. Shutemov
Here's basic implementation of huge pages support for shmem/tmpfs. It's all pretty streight-forward: - shmem_getpage() allcoates huge page if it can and try to inserd into radix tree with shmem_add_to_page_cache(); - shmem_add_to_page_cache() puts the page onto radix-tree if there's

[PATCHv6 18/30] page-flags: relax policy for PG_mappedtodisk and PG_reclaim

2016-04-06 Thread Kirill A. Shutemov
These flags are in use for file THP. Signed-off-by: Kirill A. Shutemov --- include/linux/page-flags.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 517707ae8cd1..9d518876dd6a 100644 ---

[PATCHv6 15/30] thp: file pages support for split_huge_page()

2016-04-06 Thread Kirill A. Shutemov
Basic scheme is the same as for anon THP. Main differences: - File pages are on radix-tree, so we have head->_count offset by HPAGE_PMD_NR. The count got distributed to small pages during split. - mapping->tree_lock prevents non-lockless access to pages under split over radix-tree;

[PATCHv6 25/30] shmem: add huge pages support

2016-04-06 Thread Kirill A. Shutemov
Here's basic implementation of huge pages support for shmem/tmpfs. It's all pretty streight-forward: - shmem_getpage() allcoates huge page if it can and try to inserd into radix tree with shmem_add_to_page_cache(); - shmem_add_to_page_cache() puts the page onto radix-tree if there's

[PATCHv6 26/30] shmem, thp: respect MADV_{NO,}HUGEPAGE for file mappings

2016-04-06 Thread Kirill A. Shutemov
Let's wire up existing madvise() hugepage hints for file mappings. MADV_HUGEPAGE advise shmem to allocate huge page on page fault in the VMA. It only has effect if the filesystem is mounted with huge=advise or huge=within_size. MADV_NOHUGEPAGE prevents hugepage from being allocated on page fault

[PATCHv6 19/30] radix-tree: implement radix_tree_maybe_preload_order()

2016-04-06 Thread Kirill A. Shutemov
The new helper is similar to radix_tree_maybe_preload(), but tries to preload number of nodes required to insert (1 << order) continuous naturally-aligned elements. This is required to push huge pages into pagecache. Signed-off-by: Kirill A. Shutemov ---

[PATCHv6 26/30] shmem, thp: respect MADV_{NO,}HUGEPAGE for file mappings

2016-04-06 Thread Kirill A. Shutemov
Let's wire up existing madvise() hugepage hints for file mappings. MADV_HUGEPAGE advise shmem to allocate huge page on page fault in the VMA. It only has effect if the filesystem is mounted with huge=advise or huge=within_size. MADV_NOHUGEPAGE prevents hugepage from being allocated on page fault

[PATCHv6 19/30] radix-tree: implement radix_tree_maybe_preload_order()

2016-04-06 Thread Kirill A. Shutemov
The new helper is similar to radix_tree_maybe_preload(), but tries to preload number of nodes required to insert (1 << order) continuous naturally-aligned elements. This is required to push huge pages into pagecache. Signed-off-by: Kirill A. Shutemov --- include/linux/radix-tree.h | 1 +

Re: [PATCH 1/2] lkdtm: fix memory leak of val

2016-04-06 Thread Kees Cook
On Tue, Apr 5, 2016 at 10:11 AM, Sudip Mukherjee wrote: > This case is supposed to read from a page after after it is freed, but > it missed freeing val if we are not able to get a free page. > > Signed-off-by: Sudip Mukherjee > --- >

Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions

2016-04-06 Thread Tejun Heo
Hello, On Wed, Apr 06, 2016 at 05:51:45PM -0400, Waiman Long wrote: > >>+ /* > >>+* If a statistics count is in the middle of being updated, it > >>+* is possible that the above clearing may not work. So we need > >>+* to double check again to make sure that the counters are really

[PATCHv6 29/30] khugepaged: move up_read(mmap_sem) out of khugepaged_alloc_page()

2016-04-06 Thread Kirill A. Shutemov
Both variants of khugepaged_alloc_page() do up_read(>mmap_sem) first: no point keep it inside the function. Signed-off-by: Kirill A. Shutemov --- mm/khugepaged.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git

[PATCHv6 11/30] thp: handle file pages in mremap()

2016-04-06 Thread Kirill A. Shutemov
We need to mirror logic in move_ptes() wrt need_rmap_locks to get proper serialization file THP. Signed-off-by: Kirill A. Shutemov --- mm/mremap.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mm/mremap.c

Re: [PATCH 1/2] lkdtm: fix memory leak of val

2016-04-06 Thread Kees Cook
On Tue, Apr 5, 2016 at 10:11 AM, Sudip Mukherjee wrote: > This case is supposed to read from a page after after it is freed, but > it missed freeing val if we are not able to get a free page. > > Signed-off-by: Sudip Mukherjee > --- > drivers/misc/lkdtm.c | 3 ++- > 1 file changed, 2

Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions

2016-04-06 Thread Tejun Heo
Hello, On Wed, Apr 06, 2016 at 05:51:45PM -0400, Waiman Long wrote: > >>+ /* > >>+* If a statistics count is in the middle of being updated, it > >>+* is possible that the above clearing may not work. So we need > >>+* to double check again to make sure that the counters are really

[PATCHv6 29/30] khugepaged: move up_read(mmap_sem) out of khugepaged_alloc_page()

2016-04-06 Thread Kirill A. Shutemov
Both variants of khugepaged_alloc_page() do up_read(>mmap_sem) first: no point keep it inside the function. Signed-off-by: Kirill A. Shutemov --- mm/khugepaged.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c

[PATCHv6 11/30] thp: handle file pages in mremap()

2016-04-06 Thread Kirill A. Shutemov
We need to mirror logic in move_ptes() wrt need_rmap_locks to get proper serialization file THP. Signed-off-by: Kirill A. Shutemov --- mm/mremap.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index

[PATCHv6 21/30] truncate: handle file thp

2016-04-06 Thread Kirill A. Shutemov
For shmem/tmpfs we only need to tweak truncate_inode_page() and invalidate_mapping_pages(). Signed-off-by: Kirill A. Shutemov --- mm/truncate.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mm/truncate.c

[PATCHv6 21/30] truncate: handle file thp

2016-04-06 Thread Kirill A. Shutemov
For shmem/tmpfs we only need to tweak truncate_inode_page() and invalidate_mapping_pages(). Signed-off-by: Kirill A. Shutemov --- mm/truncate.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mm/truncate.c b/mm/truncate.c index

[PATCHv6 17/30] vmscan: split file huge pages before paging them out

2016-04-06 Thread Kirill A. Shutemov
This is preparation of vmscan for file huge pages. We cannot write out huge pages, so we need to split them on the way out. Signed-off-by: Kirill A. Shutemov --- mm/vmscan.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c

[PATCHv6 23/30] shmem: prepare huge= mount option and sysfs knob

2016-04-06 Thread Kirill A. Shutemov
This patch adds new mount option "huge=". It can have following values: - "always": Attempt to allocate huge pages every time we need a new page; - "never": Do not allocate huge pages; - "within_size": Only allocate huge page if it will be fully within i_size.

[PATCHv6 17/30] vmscan: split file huge pages before paging them out

2016-04-06 Thread Kirill A. Shutemov
This is preparation of vmscan for file huge pages. We cannot write out huge pages, so we need to split them on the way out. Signed-off-by: Kirill A. Shutemov --- mm/vmscan.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index b934223eaa45..4cc96ba44a34

[PATCHv6 23/30] shmem: prepare huge= mount option and sysfs knob

2016-04-06 Thread Kirill A. Shutemov
This patch adds new mount option "huge=". It can have following values: - "always": Attempt to allocate huge pages every time we need a new page; - "never": Do not allocate huge pages; - "within_size": Only allocate huge page if it will be fully within i_size.

[PATCHv6 30/30] khugepaged: add support of collapse for tmpfs/shmem pages

2016-04-06 Thread Kirill A. Shutemov
This patch extends khugepaged to support collapse of tmpfs/shmem pages. We share fair amount of infrastructure with anon-THP collapse. Few design points: - First we are looking for VMA which can be suitable for mapping huge page; - If the VMA maps shmem file, the rest scan/collapse

[PATCHv6 13/30] thp: prepare change_huge_pmd() for file thp

2016-04-06 Thread Kirill A. Shutemov
change_huge_pmd() has assert which is not relvant for file page. For shared mapping it's perfectly fine to have page table entry writable, without explicit mkwrite. Signed-off-by: Kirill A. Shutemov --- mm/huge_memory.c | 3 ++- 1 file changed, 2 insertions(+),

[PATCHv6 30/30] khugepaged: add support of collapse for tmpfs/shmem pages

2016-04-06 Thread Kirill A. Shutemov
This patch extends khugepaged to support collapse of tmpfs/shmem pages. We share fair amount of infrastructure with anon-THP collapse. Few design points: - First we are looking for VMA which can be suitable for mapping huge page; - If the VMA maps shmem file, the rest scan/collapse

[PATCHv6 13/30] thp: prepare change_huge_pmd() for file thp

2016-04-06 Thread Kirill A. Shutemov
change_huge_pmd() has assert which is not relvant for file page. For shared mapping it's perfectly fine to have page table entry writable, without explicit mkwrite. Signed-off-by: Kirill A. Shutemov --- mm/huge_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

<    1   2   3   4   5   6   7   8   9   10   >