mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:19:34 +02:00
mm/vma: use vma_start_pgoff(), linear_page_index() in mm code
There are many instances in which linear_page_index() (as well as linear_page_delta()) is open-coded, which is confusing and inconsistent. Additionally, vma->vm_pgoff doesn't necessarily make it clear that this is the page offset of the start of the VMA range. Doing so also aids greppability. So use vma_start_pgoff() in favour of directly accessing vma->vm_pgoff, and linear_page_index() where we can. This also lays the ground for future changes which will add an anonymous page offset in order to be able to index MAP_PRIVATE-file backed anon folios in terms of their virtual page offset. No functional change intended. Link: https://lore.kernel.org/20260710-b4-pre-scalable-cow-v2-18-2a5aa403d977@kernel.org Signed-off-by: Lorenzo Stoakes <ljs@kernel.org> Reviewed-by: Gregory Price <gourry@gourry.net> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Pedro Falcato <pfalcato@suse.de> Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Cc: Ackerley Tng <ackerleytng@google.com> Cc: David Hildenbrand (Arm) <david@kernel.org> Cc: Kai Huang <kai.huang@intel.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Liam R. Howlett (Oracle) <liam@infradead.org> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
1268e1572b
commit
5872168de5
@@ -230,6 +230,7 @@ static inline bool thp_vma_suitable_order(struct vm_area_struct *vma,
|
|||||||
|
|
||||||
/* Don't have to check pgoff for anonymous vma */
|
/* Don't have to check pgoff for anonymous vma */
|
||||||
if (!vma_is_anonymous(vma)) {
|
if (!vma_is_anonymous(vma)) {
|
||||||
|
/* vma_start_pgoff() in mm.h so not available. */
|
||||||
if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
|
if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
|
||||||
hpage_size >> PAGE_SHIFT))
|
hpage_size >> PAGE_SHIFT))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -801,8 +801,7 @@ static inline pgoff_t hugetlb_linear_page_index(struct vm_area_struct *vma,
|
|||||||
{
|
{
|
||||||
struct hstate *h = hstate_vma(vma);
|
struct hstate *h = hstate_vma(vma);
|
||||||
|
|
||||||
return ((address - vma->vm_start) >> huge_page_shift(h)) +
|
return linear_page_index(vma, address) >> huge_page_order(h);
|
||||||
(vma->vm_pgoff >> huge_page_order(h));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool order_is_gigantic(unsigned int order)
|
static inline bool order_is_gigantic(unsigned int order)
|
||||||
|
|||||||
@@ -1097,7 +1097,7 @@ static inline pgoff_t linear_page_index(const struct vm_area_struct *vma,
|
|||||||
pgoff_t pgoff;
|
pgoff_t pgoff;
|
||||||
|
|
||||||
pgoff = linear_page_delta(vma, address);
|
pgoff = linear_page_delta(vma, address);
|
||||||
pgoff += vma->vm_pgoff;
|
pgoff += vma_start_pgoff(vma);
|
||||||
return pgoff;
|
return pgoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/mmu_notifier.h>
|
#include <linux/mmu_notifier.h>
|
||||||
#include <linux/page_idle.h>
|
#include <linux/page_idle.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
#include <linux/pagewalk.h>
|
#include <linux/pagewalk.h>
|
||||||
#include <linux/sched/mm.h>
|
#include <linux/sched/mm.h>
|
||||||
|
|
||||||
@@ -623,8 +624,8 @@ static void damos_va_migrate_dests_add(struct folio *folio,
|
|||||||
}
|
}
|
||||||
|
|
||||||
order = folio_order(folio);
|
order = folio_order(folio);
|
||||||
ilx = vma->vm_pgoff >> order;
|
ilx = vma_start_pgoff(vma) >> order;
|
||||||
ilx += (addr - vma->vm_start) >> (PAGE_SHIFT + order);
|
ilx += linear_page_delta(vma, addr) >> order;
|
||||||
|
|
||||||
for (i = 0; i < dests->nr_dests; i++)
|
for (i = 0; i < dests->nr_dests; i++)
|
||||||
weight_total += dests->weight_arr[i];
|
weight_total += dests->weight_arr[i];
|
||||||
|
|||||||
+1
-1
@@ -163,7 +163,7 @@ void dump_vma(const struct vm_area_struct *vma)
|
|||||||
"flags: %#lx(%pGv)\n",
|
"flags: %#lx(%pGv)\n",
|
||||||
vma, (void *)vma->vm_start, (void *)vma->vm_end, vma->vm_mm,
|
vma, (void *)vma->vm_start, (void *)vma->vm_end, vma->vm_mm,
|
||||||
(unsigned long)pgprot_val(vma->vm_page_prot),
|
(unsigned long)pgprot_val(vma->vm_page_prot),
|
||||||
vma->anon_vma, vma->vm_ops, vma->vm_pgoff,
|
vma->anon_vma, vma->vm_ops, vma_start_pgoff(vma),
|
||||||
vma->vm_file, vma->vm_private_data,
|
vma->vm_file, vma->vm_private_data,
|
||||||
#ifdef CONFIG_PER_VMA_LOCK
|
#ifdef CONFIG_PER_VMA_LOCK
|
||||||
refcount_read(&vma->vm_refcnt),
|
refcount_read(&vma->vm_refcnt),
|
||||||
|
|||||||
+4
-3
@@ -3411,8 +3411,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
|
|||||||
* of memory.
|
* of memory.
|
||||||
*/
|
*/
|
||||||
struct vm_area_struct *vma = vmf->vma;
|
struct vm_area_struct *vma = vmf->vma;
|
||||||
unsigned long start = vma->vm_pgoff;
|
const unsigned long start = vma_start_pgoff(vma);
|
||||||
unsigned long end = start + vma_pages(vma);
|
const unsigned long end = vma_end_pgoff(vma);
|
||||||
unsigned long ra_end;
|
unsigned long ra_end;
|
||||||
|
|
||||||
ra->order = exec_folio_order();
|
ra->order = exec_folio_order();
|
||||||
@@ -3930,7 +3930,8 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = vma->vm_start + ((start_pgoff - vma->vm_pgoff) << PAGE_SHIFT);
|
addr = vma->vm_start +
|
||||||
|
((start_pgoff - vma_start_pgoff(vma)) << PAGE_SHIFT);
|
||||||
vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, addr, &vmf->ptl);
|
vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, addr, &vmf->ptl);
|
||||||
if (!vmf->pte) {
|
if (!vmf->pte) {
|
||||||
folio_unlock(folio);
|
folio_unlock(folio);
|
||||||
|
|||||||
+1
-1
@@ -180,7 +180,7 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
|
|||||||
*/
|
*/
|
||||||
if (!in_pf && shmem_file(vma->vm_file))
|
if (!in_pf && shmem_file(vma->vm_file))
|
||||||
return orders & shmem_allowable_huge_orders(file_inode(vma->vm_file),
|
return orders & shmem_allowable_huge_orders(file_inode(vma->vm_file),
|
||||||
vma, vma->vm_pgoff, 0,
|
vma, vma_start_pgoff(vma), 0,
|
||||||
forced_collapse);
|
forced_collapse);
|
||||||
|
|
||||||
if (!vma_is_anonymous(vma)) {
|
if (!vma_is_anonymous(vma)) {
|
||||||
|
|||||||
+4
-7
@@ -1012,8 +1012,7 @@ static long region_count(struct resv_map *resv, long f, long t)
|
|||||||
static pgoff_t vma_hugecache_offset(struct hstate *h,
|
static pgoff_t vma_hugecache_offset(struct hstate *h,
|
||||||
struct vm_area_struct *vma, unsigned long address)
|
struct vm_area_struct *vma, unsigned long address)
|
||||||
{
|
{
|
||||||
return ((address - vma->vm_start) >> huge_page_shift(h)) +
|
return linear_page_index(vma, address) >> huge_page_order(h);
|
||||||
(vma->vm_pgoff >> huge_page_order(h));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5433,8 +5432,7 @@ static void unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
|
|||||||
* from page cache lookup which is in HPAGE_SIZE units.
|
* from page cache lookup which is in HPAGE_SIZE units.
|
||||||
*/
|
*/
|
||||||
address = address & huge_page_mask(h);
|
address = address & huge_page_mask(h);
|
||||||
pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
|
pgoff = linear_page_index(vma, address);
|
||||||
vma->vm_pgoff;
|
|
||||||
mapping = vma->vm_file->f_mapping;
|
mapping = vma->vm_file->f_mapping;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6893,7 +6891,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
|
|||||||
struct vm_area_struct *vma,
|
struct vm_area_struct *vma,
|
||||||
unsigned long addr, pgoff_t idx)
|
unsigned long addr, pgoff_t idx)
|
||||||
{
|
{
|
||||||
unsigned long saddr = ((idx - svma->vm_pgoff) << PAGE_SHIFT) +
|
unsigned long saddr = ((idx - vma_start_pgoff(svma)) << PAGE_SHIFT) +
|
||||||
svma->vm_start;
|
svma->vm_start;
|
||||||
unsigned long sbase = saddr & PUD_MASK;
|
unsigned long sbase = saddr & PUD_MASK;
|
||||||
unsigned long s_end = sbase + PUD_SIZE;
|
unsigned long s_end = sbase + PUD_SIZE;
|
||||||
@@ -6978,8 +6976,7 @@ pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma,
|
|||||||
unsigned long addr, pud_t *pud)
|
unsigned long addr, pud_t *pud)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = vma->vm_file->f_mapping;
|
struct address_space *mapping = vma->vm_file->f_mapping;
|
||||||
pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) +
|
const pgoff_t idx = linear_page_index(vma, addr);
|
||||||
vma->vm_pgoff;
|
|
||||||
struct vm_area_struct *svma;
|
struct vm_area_struct *svma;
|
||||||
unsigned long saddr;
|
unsigned long saddr;
|
||||||
pte_t *spte = NULL;
|
pte_t *spte = NULL;
|
||||||
|
|||||||
+14
-10
@@ -924,26 +924,28 @@ static inline bool
|
|||||||
folio_within_range(struct folio *folio, struct vm_area_struct *vma,
|
folio_within_range(struct folio *folio, struct vm_area_struct *vma,
|
||||||
unsigned long start, unsigned long end)
|
unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
pgoff_t pgoff, addr;
|
const unsigned long vma_pglen = vma_pages(vma);
|
||||||
unsigned long vma_pglen = vma_pages(vma);
|
pgoff_t pgoff_folio, pgoff_vma_start;
|
||||||
|
unsigned long addr;
|
||||||
|
|
||||||
VM_WARN_ON_FOLIO(folio_test_ksm(folio), folio);
|
VM_WARN_ON_FOLIO(folio_test_ksm(folio), folio);
|
||||||
if (start > end)
|
if (start > end)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
pgoff_folio = folio_pgoff(folio);
|
||||||
|
pgoff_vma_start = vma_start_pgoff(vma);
|
||||||
|
|
||||||
if (start < vma->vm_start)
|
if (start < vma->vm_start)
|
||||||
start = vma->vm_start;
|
start = vma->vm_start;
|
||||||
|
|
||||||
if (end > vma->vm_end)
|
if (end > vma->vm_end)
|
||||||
end = vma->vm_end;
|
end = vma->vm_end;
|
||||||
|
|
||||||
pgoff = folio_pgoff(folio);
|
|
||||||
|
|
||||||
/* if folio start address is not in vma range */
|
/* if folio start address is not in vma range */
|
||||||
if (!in_range(pgoff, vma->vm_pgoff, vma_pglen))
|
if (!in_range(pgoff_folio, pgoff_vma_start, vma_pglen))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
addr = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
|
addr = vma->vm_start + ((pgoff_folio - pgoff_vma_start) << PAGE_SHIFT);
|
||||||
|
|
||||||
return !(addr < start || end - addr < folio_size(folio));
|
return !(addr < start || end - addr < folio_size(folio));
|
||||||
}
|
}
|
||||||
@@ -1015,15 +1017,16 @@ extern pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma);
|
|||||||
static inline unsigned long vma_address(const struct vm_area_struct *vma,
|
static inline unsigned long vma_address(const struct vm_area_struct *vma,
|
||||||
pgoff_t pgoff, unsigned long nr_pages)
|
pgoff_t pgoff, unsigned long nr_pages)
|
||||||
{
|
{
|
||||||
|
const pgoff_t pgoff_start = vma_start_pgoff(vma);
|
||||||
unsigned long address;
|
unsigned long address;
|
||||||
|
|
||||||
if (pgoff >= vma->vm_pgoff) {
|
if (pgoff >= pgoff_start) {
|
||||||
address = vma->vm_start +
|
address = vma->vm_start +
|
||||||
((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
|
((pgoff - pgoff_start) << PAGE_SHIFT);
|
||||||
/* Check for address beyond vma (or wrapped through 0?) */
|
/* Check for address beyond vma (or wrapped through 0?) */
|
||||||
if (address < vma->vm_start || address >= vma->vm_end)
|
if (address < vma->vm_start || address >= vma->vm_end)
|
||||||
address = -EFAULT;
|
address = -EFAULT;
|
||||||
} else if (pgoff + nr_pages - 1 >= vma->vm_pgoff) {
|
} else if (pgoff + nr_pages - 1 >= pgoff_start) {
|
||||||
/* Test above avoids possibility of wrap to 0 on 32-bit */
|
/* Test above avoids possibility of wrap to 0 on 32-bit */
|
||||||
address = vma->vm_start;
|
address = vma->vm_start;
|
||||||
} else {
|
} else {
|
||||||
@@ -1047,7 +1050,8 @@ static inline unsigned long vma_address_end(struct page_vma_mapped_walk *pvmw)
|
|||||||
return pvmw->address + PAGE_SIZE;
|
return pvmw->address + PAGE_SIZE;
|
||||||
|
|
||||||
pgoff = pvmw->pgoff + pvmw->nr_pages;
|
pgoff = pvmw->pgoff + pvmw->nr_pages;
|
||||||
address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
|
address = vma->vm_start +
|
||||||
|
((pgoff - vma_start_pgoff(vma)) << PAGE_SHIFT);
|
||||||
/* Check for address beyond vma (or wrapped through 0?) */
|
/* Check for address beyond vma (or wrapped through 0?) */
|
||||||
if (address < vma->vm_start || address > vma->vm_end)
|
if (address < vma->vm_start || address > vma->vm_end)
|
||||||
address = vma->vm_end;
|
address = vma->vm_end;
|
||||||
|
|||||||
+2
-1
@@ -2150,7 +2150,8 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)
|
|||||||
spinlock_t *ptl;
|
spinlock_t *ptl;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
addr = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
|
addr = vma->vm_start +
|
||||||
|
((pgoff - vma_start_pgoff(vma)) << PAGE_SHIFT);
|
||||||
if (addr & ~HPAGE_PMD_MASK ||
|
if (addr & ~HPAGE_PMD_MASK ||
|
||||||
vma->vm_end < addr + HPAGE_PMD_SIZE)
|
vma->vm_end < addr + HPAGE_PMD_SIZE)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+3
-3
@@ -253,7 +253,7 @@ static void shmem_swapin_range(struct vm_area_struct *vma,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
addr = vma->vm_start +
|
addr = vma->vm_start +
|
||||||
((xas.xa_index - vma->vm_pgoff) << PAGE_SHIFT);
|
((xas.xa_index - vma_start_pgoff(vma)) << PAGE_SHIFT);
|
||||||
xas_pause(&xas);
|
xas_pause(&xas);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ static long madvise_willneed(struct madvise_behavior *madv_behavior)
|
|||||||
mark_mmap_lock_dropped(madv_behavior);
|
mark_mmap_lock_dropped(madv_behavior);
|
||||||
get_file(file);
|
get_file(file);
|
||||||
offset = (loff_t)(start - vma->vm_start)
|
offset = (loff_t)(start - vma->vm_start)
|
||||||
+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
|
+ ((loff_t)vma_start_pgoff(vma) << PAGE_SHIFT);
|
||||||
mmap_read_unlock(mm);
|
mmap_read_unlock(mm);
|
||||||
vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
|
vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
|
||||||
fput(file);
|
fput(file);
|
||||||
@@ -1022,7 +1022,7 @@ static long madvise_remove(struct madvise_behavior *madv_behavior)
|
|||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
offset = (loff_t)(start - vma->vm_start)
|
offset = (loff_t)(start - vma->vm_start)
|
||||||
+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
|
+ ((loff_t)vma_start_pgoff(vma) << PAGE_SHIFT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Filesystem's fallocate may need to take i_rwsem. We need to
|
* Filesystem's fallocate may need to take i_rwsem. We need to
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ static int clean_record_pte(pte_t *pte, unsigned long addr,
|
|||||||
|
|
||||||
if (pte_dirty(ptent)) {
|
if (pte_dirty(ptent)) {
|
||||||
pgoff_t pgoff = ((addr - walk->vma->vm_start) >> PAGE_SHIFT) +
|
pgoff_t pgoff = ((addr - walk->vma->vm_start) >> PAGE_SHIFT) +
|
||||||
walk->vma->vm_pgoff - cwalk->bitmap_pgoff;
|
vma_start_pgoff(walk->vma) - cwalk->bitmap_pgoff;
|
||||||
pte_t old_pte = ptep_modify_prot_start(walk->vma, addr, pte);
|
pte_t old_pte = ptep_modify_prot_start(walk->vma, addr, pte);
|
||||||
|
|
||||||
ptent = pte_mkclean(old_pte);
|
ptent = pte_mkclean(old_pte);
|
||||||
|
|||||||
+13
-12
@@ -725,10 +725,10 @@ static inline struct page *__vm_normal_page(struct vm_area_struct *vma,
|
|||||||
if (!pfn_valid(pfn))
|
if (!pfn_valid(pfn))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT;
|
const pgoff_t index = linear_page_index(vma, addr);
|
||||||
|
|
||||||
/* Only CoW'ed anon folios are "normal". */
|
/* Only CoW'ed anon folios are "normal". */
|
||||||
if (pfn == vma->vm_pgoff + off)
|
if (pfn == index)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!is_cow_mapping(vma->vm_flags))
|
if (!is_cow_mapping(vma->vm_flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -2663,7 +2663,7 @@ static int __vm_map_pages(struct vm_area_struct *vma, struct page **pages,
|
|||||||
int vm_map_pages(struct vm_area_struct *vma, struct page **pages,
|
int vm_map_pages(struct vm_area_struct *vma, struct page **pages,
|
||||||
unsigned long num)
|
unsigned long num)
|
||||||
{
|
{
|
||||||
return __vm_map_pages(vma, pages, num, vma->vm_pgoff);
|
return __vm_map_pages(vma, pages, num, vma_start_pgoff(vma));
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vm_map_pages);
|
EXPORT_SYMBOL(vm_map_pages);
|
||||||
|
|
||||||
@@ -3318,7 +3318,8 @@ int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long
|
|||||||
unsigned long pfn;
|
unsigned long pfn;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = __simple_ioremap_prep(vm_len, vma->vm_pgoff, start, len, &pfn);
|
err = __simple_ioremap_prep(vm_len, vma_start_pgoff(vma), start, len,
|
||||||
|
&pfn);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -4366,15 +4367,15 @@ static inline void unmap_mapping_range_tree(struct address_space *mapping,
|
|||||||
struct zap_details *details)
|
struct zap_details *details)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
unsigned long start, size;
|
|
||||||
struct mmu_gather tlb;
|
struct mmu_gather tlb;
|
||||||
|
|
||||||
mapping_rmap_tree_foreach(vma, mapping, first_index, last_index) {
|
mapping_rmap_tree_foreach(vma, mapping, first_index, last_index) {
|
||||||
const pgoff_t start_idx = max(first_index, vma->vm_pgoff);
|
const pgoff_t start_idx = max(first_index, vma_start_pgoff(vma));
|
||||||
const pgoff_t end_idx = min(last_index, vma_last_pgoff(vma)) + 1;
|
const pgoff_t end_idx = min(last_index, vma_last_pgoff(vma)) + 1;
|
||||||
|
const pgoff_t offset = start_idx - vma_start_pgoff(vma);
|
||||||
start = vma->vm_start + ((start_idx - vma->vm_pgoff) << PAGE_SHIFT);
|
const unsigned long offset_bytes = offset << PAGE_SHIFT;
|
||||||
size = (end_idx - start_idx) << PAGE_SHIFT;
|
const unsigned long start = vma->vm_start + offset_bytes;
|
||||||
|
const unsigned long size = (end_idx - start_idx) << PAGE_SHIFT;
|
||||||
|
|
||||||
tlb_gather_mmu(&tlb, vma->vm_mm);
|
tlb_gather_mmu(&tlb, vma->vm_mm);
|
||||||
zap_vma_range_batched(&tlb, vma, start, size, details);
|
zap_vma_range_batched(&tlb, vma, start, size, details);
|
||||||
@@ -5712,7 +5713,7 @@ fallback:
|
|||||||
} else if (nr_pages > 1) {
|
} else if (nr_pages > 1) {
|
||||||
pgoff_t idx = folio_page_idx(folio, page);
|
pgoff_t idx = folio_page_idx(folio, page);
|
||||||
/* The page offset of vmf->address within the VMA. */
|
/* The page offset of vmf->address within the VMA. */
|
||||||
pgoff_t vma_off = vmf->pgoff - vmf->vma->vm_pgoff;
|
pgoff_t vma_off = vmf->pgoff - vma_start_pgoff(vmf->vma);
|
||||||
/* The index of the entry in the pagetable for fault page. */
|
/* The index of the entry in the pagetable for fault page. */
|
||||||
pgoff_t pte_off = pte_index(vmf->address);
|
pgoff_t pte_off = pte_index(vmf->address);
|
||||||
|
|
||||||
@@ -5824,7 +5825,7 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf)
|
|||||||
pgoff_t nr_pages = READ_ONCE(fault_around_pages);
|
pgoff_t nr_pages = READ_ONCE(fault_around_pages);
|
||||||
pgoff_t pte_off = pte_index(vmf->address);
|
pgoff_t pte_off = pte_index(vmf->address);
|
||||||
/* The page offset of vmf->address within the VMA. */
|
/* The page offset of vmf->address within the VMA. */
|
||||||
pgoff_t vma_off = vmf->pgoff - vmf->vma->vm_pgoff;
|
pgoff_t vma_off = vmf->pgoff - vma_start_pgoff(vmf->vma);
|
||||||
pgoff_t from_pte, to_pte;
|
pgoff_t from_pte, to_pte;
|
||||||
vm_fault_t ret;
|
vm_fault_t ret;
|
||||||
|
|
||||||
@@ -7352,7 +7353,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
|
|||||||
if (vma && vma->vm_file) {
|
if (vma && vma->vm_file) {
|
||||||
struct file *f = vma->vm_file;
|
struct file *f = vma->vm_file;
|
||||||
ip -= vma->vm_start;
|
ip -= vma->vm_start;
|
||||||
ip += vma->vm_pgoff << PAGE_SHIFT;
|
ip += vma_start_pgoff(vma) << PAGE_SHIFT;
|
||||||
printk("%s%pD[%lx,%lx+%lx]", prefix, f, ip,
|
printk("%s%pD[%lx,%lx+%lx]", prefix, f, ip,
|
||||||
vma->vm_start,
|
vma->vm_start,
|
||||||
vma->vm_end - vma->vm_start);
|
vma->vm_end - vma->vm_start);
|
||||||
|
|||||||
+7
-6
@@ -2049,8 +2049,8 @@ struct mempolicy *get_vma_policy(struct vm_area_struct *vma,
|
|||||||
pol = get_task_policy(current);
|
pol = get_task_policy(current);
|
||||||
if (pol->mode == MPOL_INTERLEAVE ||
|
if (pol->mode == MPOL_INTERLEAVE ||
|
||||||
pol->mode == MPOL_WEIGHTED_INTERLEAVE) {
|
pol->mode == MPOL_WEIGHTED_INTERLEAVE) {
|
||||||
*ilx += vma->vm_pgoff >> order;
|
*ilx += vma_start_pgoff(vma) >> order;
|
||||||
*ilx += (addr - vma->vm_start) >> (PAGE_SHIFT + order);
|
*ilx += linear_page_delta(vma, addr) >> order;
|
||||||
}
|
}
|
||||||
return pol;
|
return pol;
|
||||||
}
|
}
|
||||||
@@ -3253,16 +3253,17 @@ EXPORT_SYMBOL_FOR_MODULES(mpol_shared_policy_init, "kvm");
|
|||||||
int mpol_set_shared_policy(struct shared_policy *sp,
|
int mpol_set_shared_policy(struct shared_policy *sp,
|
||||||
struct vm_area_struct *vma, struct mempolicy *pol)
|
struct vm_area_struct *vma, struct mempolicy *pol)
|
||||||
{
|
{
|
||||||
int err;
|
const pgoff_t pgoff = vma_start_pgoff(vma);
|
||||||
|
const pgoff_t pgoff_end = vma_end_pgoff(vma);
|
||||||
struct sp_node *new = NULL;
|
struct sp_node *new = NULL;
|
||||||
unsigned long sz = vma_pages(vma);
|
int err;
|
||||||
|
|
||||||
if (pol) {
|
if (pol) {
|
||||||
new = sp_alloc(vma->vm_pgoff, vma->vm_pgoff + sz, pol);
|
new = sp_alloc(pgoff, pgoff_end, pol);
|
||||||
if (!new)
|
if (!new)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
err = shared_policy_replace(sp, vma->vm_pgoff, vma->vm_pgoff + sz, new);
|
err = shared_policy_replace(sp, pgoff, pgoff_end, new);
|
||||||
if (err && new)
|
if (err && new)
|
||||||
sp_free(new);
|
sp_free(new);
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
+4
-8
@@ -957,8 +957,7 @@ static unsigned long vrm_set_new_addr(struct vma_remap_struct *vrm)
|
|||||||
struct vm_area_struct *vma = vrm->vma;
|
struct vm_area_struct *vma = vrm->vma;
|
||||||
unsigned long map_flags = 0;
|
unsigned long map_flags = 0;
|
||||||
/* Page Offset _into_ the VMA. */
|
/* Page Offset _into_ the VMA. */
|
||||||
pgoff_t internal_pgoff = (vrm->addr - vma->vm_start) >> PAGE_SHIFT;
|
const pgoff_t pgoff = linear_page_index(vma, vrm->addr);
|
||||||
pgoff_t pgoff = vma->vm_pgoff + internal_pgoff;
|
|
||||||
unsigned long new_addr = vrm_implies_new_addr(vrm) ? vrm->new_addr : 0;
|
unsigned long new_addr = vrm_implies_new_addr(vrm) ? vrm->new_addr : 0;
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
|
|
||||||
@@ -1264,12 +1263,10 @@ static void unmap_source_vma(struct vma_remap_struct *vrm)
|
|||||||
static int copy_vma_and_data(struct vma_remap_struct *vrm,
|
static int copy_vma_and_data(struct vma_remap_struct *vrm,
|
||||||
struct vm_area_struct **new_vma_ptr)
|
struct vm_area_struct **new_vma_ptr)
|
||||||
{
|
{
|
||||||
unsigned long internal_offset = vrm->addr - vrm->vma->vm_start;
|
const unsigned long new_pgoff = linear_page_index(vrm->vma, vrm->addr);
|
||||||
unsigned long internal_pgoff = internal_offset >> PAGE_SHIFT;
|
|
||||||
unsigned long new_pgoff = vrm->vma->vm_pgoff + internal_pgoff;
|
|
||||||
unsigned long moved_len;
|
|
||||||
struct vm_area_struct *vma = vrm->vma;
|
struct vm_area_struct *vma = vrm->vma;
|
||||||
struct vm_area_struct *new_vma;
|
struct vm_area_struct *new_vma;
|
||||||
|
unsigned long moved_len;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
PAGETABLE_MOVE(pmc, NULL, NULL, vrm->addr, vrm->new_addr, vrm->old_len);
|
PAGETABLE_MOVE(pmc, NULL, NULL, vrm->addr, vrm->new_addr, vrm->old_len);
|
||||||
|
|
||||||
@@ -1811,8 +1808,7 @@ static int check_prep_vma(struct vma_remap_struct *vrm)
|
|||||||
vrm->populate_expand = true;
|
vrm->populate_expand = true;
|
||||||
|
|
||||||
/* Need to be careful about a growing mapping */
|
/* Need to be careful about a growing mapping */
|
||||||
pgoff = (addr - vma->vm_start) >> PAGE_SHIFT;
|
pgoff = linear_page_index(vma, addr);
|
||||||
pgoff += vma->vm_pgoff;
|
|
||||||
if (pgoff + (new_len >> PAGE_SHIFT) < pgoff)
|
if (pgoff + (new_len >> PAGE_SHIFT) < pgoff)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,7 @@
|
|||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
|
||||||
@@ -85,8 +86,7 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
file = vma->vm_file;
|
file = vma->vm_file;
|
||||||
fstart = (start - vma->vm_start) +
|
fstart = (loff_t)linear_page_index(vma, start) << PAGE_SHIFT;
|
||||||
((loff_t)vma->vm_pgoff << PAGE_SHIFT);
|
|
||||||
fend = fstart + (min(end, vma->vm_end) - start) - 1;
|
fend = fstart + (min(end, vma->vm_end) - start) - 1;
|
||||||
start = vma->vm_end;
|
start = vma->vm_end;
|
||||||
if ((flags & MS_SYNC) && file &&
|
if ((flags & MS_SYNC) && file &&
|
||||||
|
|||||||
+4
-3
@@ -975,7 +975,7 @@ static int do_mmap_private(struct vm_area_struct *vma,
|
|||||||
/* read the contents of a file into the copy */
|
/* read the contents of a file into the copy */
|
||||||
loff_t fpos;
|
loff_t fpos;
|
||||||
|
|
||||||
fpos = vma->vm_pgoff;
|
fpos = vma_start_pgoff(vma);
|
||||||
fpos <<= PAGE_SHIFT;
|
fpos <<= PAGE_SHIFT;
|
||||||
|
|
||||||
ret = kernel_read(vma->vm_file, base, len, &fpos);
|
ret = kernel_read(vma->vm_file, base, len, &fpos);
|
||||||
@@ -1378,7 +1378,8 @@ static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
|||||||
delete_nommu_region(vma->vm_region);
|
delete_nommu_region(vma->vm_region);
|
||||||
if (new_below) {
|
if (new_below) {
|
||||||
vma->vm_region->vm_start = vma->vm_start = addr;
|
vma->vm_region->vm_start = vma->vm_start = addr;
|
||||||
vma->vm_region->vm_pgoff = vma->vm_pgoff += npages;
|
vma->vm_pgoff += npages;
|
||||||
|
vma->vm_region->vm_pgoff = vma_start_pgoff(vma);
|
||||||
} else {
|
} else {
|
||||||
vma->vm_region->vm_end = vma->vm_end = addr;
|
vma->vm_region->vm_end = vma->vm_end = addr;
|
||||||
vma->vm_region->vm_top = addr;
|
vma->vm_region->vm_top = addr;
|
||||||
@@ -1626,7 +1627,7 @@ int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long
|
|||||||
unsigned long pfn = start >> PAGE_SHIFT;
|
unsigned long pfn = start >> PAGE_SHIFT;
|
||||||
unsigned long vm_len = vma->vm_end - vma->vm_start;
|
unsigned long vm_len = vma->vm_end - vma->vm_start;
|
||||||
|
|
||||||
pfn += vma->vm_pgoff;
|
pfn += vma_start_pgoff(vma);
|
||||||
return io_remap_pfn_range(vma, vma->vm_start, pfn, vm_len, vma->vm_page_prot);
|
return io_remap_pfn_range(vma, vma->vm_start, pfn, vm_len, vma->vm_page_prot);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vm_iomap_memory);
|
EXPORT_SYMBOL(vm_iomap_memory);
|
||||||
|
|||||||
+1
-1
@@ -813,7 +813,7 @@ int walk_page_mapping(struct address_space *mapping, pgoff_t first_index,
|
|||||||
mapping_rmap_tree_foreach(vma, mapping, first_index,
|
mapping_rmap_tree_foreach(vma, mapping, first_index,
|
||||||
first_index + nr - 1) {
|
first_index + nr - 1) {
|
||||||
/* Clip to the vma */
|
/* Clip to the vma */
|
||||||
vba = vma->vm_pgoff;
|
vba = vma_start_pgoff(vma);
|
||||||
vea = vba + vma_pages(vma);
|
vea = vba + vma_pages(vma);
|
||||||
cba = first_index;
|
cba = first_index;
|
||||||
cba = max(cba, vba);
|
cba = max(cba, vba);
|
||||||
|
|||||||
+5
-4
@@ -1042,6 +1042,8 @@ unsigned long shmem_swap_usage(struct vm_area_struct *vma)
|
|||||||
struct inode *inode = file_inode(vma->vm_file);
|
struct inode *inode = file_inode(vma->vm_file);
|
||||||
struct shmem_inode_info *info = SHMEM_I(inode);
|
struct shmem_inode_info *info = SHMEM_I(inode);
|
||||||
struct address_space *mapping = inode->i_mapping;
|
struct address_space *mapping = inode->i_mapping;
|
||||||
|
const pgoff_t pgoff = vma_start_pgoff(vma);
|
||||||
|
const pgoff_t pgoff_end = vma_end_pgoff(vma);
|
||||||
unsigned long swapped;
|
unsigned long swapped;
|
||||||
|
|
||||||
/* Be careful as we don't hold info->lock */
|
/* Be careful as we don't hold info->lock */
|
||||||
@@ -1055,12 +1057,11 @@ unsigned long shmem_swap_usage(struct vm_area_struct *vma)
|
|||||||
if (!swapped)
|
if (!swapped)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!vma->vm_pgoff && vma->vm_end - vma->vm_start >= inode->i_size)
|
if (!pgoff && vma->vm_end - vma->vm_start >= inode->i_size)
|
||||||
return swapped << PAGE_SHIFT;
|
return swapped << PAGE_SHIFT;
|
||||||
|
|
||||||
/* Here comes the more involved part */
|
/* Here comes the more involved part */
|
||||||
return shmem_partial_swap_usage(mapping, vma->vm_pgoff,
|
return shmem_partial_swap_usage(mapping, pgoff, pgoff_end);
|
||||||
vma->vm_pgoff + vma_pages(vma));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2850,7 +2851,7 @@ static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
|
|||||||
* by page order, as in shmem_get_pgoff_policy() and get_vma_policy()).
|
* by page order, as in shmem_get_pgoff_policy() and get_vma_policy()).
|
||||||
*/
|
*/
|
||||||
*ilx = inode->i_ino;
|
*ilx = inode->i_ino;
|
||||||
index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
|
index = linear_page_index(vma, addr);
|
||||||
return mpol_shared_policy_lookup(&SHMEM_I(inode)->policy, index);
|
return mpol_shared_policy_lookup(&SHMEM_I(inode)->policy, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -481,7 +481,7 @@ static void mfill_retry_state_save(struct mfill_retry_state *s,
|
|||||||
{
|
{
|
||||||
s->flags = vma_flags_and_mask(&vma->flags, MFILL_RETRY_STATE_VMA_FLAGS);
|
s->flags = vma_flags_and_mask(&vma->flags, MFILL_RETRY_STATE_VMA_FLAGS);
|
||||||
s->ops = vma_uffd_ops(vma);
|
s->ops = vma_uffd_ops(vma);
|
||||||
s->pgoff = vma->vm_pgoff;
|
s->pgoff = vma_start_pgoff(vma);
|
||||||
|
|
||||||
if (vma->vm_file)
|
if (vma->vm_file)
|
||||||
s->file = get_file(vma->vm_file);
|
s->file = get_file(vma->vm_file);
|
||||||
@@ -507,7 +507,7 @@ static bool mfill_retry_state_changed(struct mfill_retry_state *state,
|
|||||||
|
|
||||||
/* VMA was file backed, but file, inode or offset has changed */
|
/* VMA was file backed, but file, inode or offset has changed */
|
||||||
if (!vma->vm_file || vma->vm_file->f_inode != state->file->f_inode ||
|
if (!vma->vm_file || vma->vm_file->f_inode != state->file->f_inode ||
|
||||||
state->file != vma->vm_file || vma->vm_pgoff != state->pgoff)
|
state->file != vma->vm_file || vma_start_pgoff(vma) != state->pgoff)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1188,7 +1188,7 @@ void compat_set_desc_from_vma(struct vm_area_desc *desc,
|
|||||||
desc->start = vma->vm_start;
|
desc->start = vma->vm_start;
|
||||||
desc->end = vma->vm_end;
|
desc->end = vma->vm_end;
|
||||||
|
|
||||||
desc->pgoff = vma->vm_pgoff;
|
desc->pgoff = vma_start_pgoff(vma);
|
||||||
desc->vm_file = vma->vm_file;
|
desc->vm_file = vma->vm_file;
|
||||||
desc->vma_flags = vma->flags;
|
desc->vma_flags = vma->flags;
|
||||||
desc->page_prot = vma->vm_page_prot;
|
desc->page_prot = vma->vm_page_prot;
|
||||||
@@ -1379,7 +1379,7 @@ static int call_vma_mapped(struct vm_area_struct *vma)
|
|||||||
if (!vm_ops || !vm_ops->mapped)
|
if (!vm_ops || !vm_ops->mapped)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err = vm_ops->mapped(vma->vm_start, vma->vm_end, vma->vm_pgoff,
|
err = vm_ops->mapped(vma->vm_start, vma->vm_end, vma_start_pgoff(vma),
|
||||||
vma->vm_file, &vm_private_data);
|
vma->vm_file, &vm_private_data);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -967,10 +967,9 @@ static __must_check struct vm_area_struct *vma_merge_existing_range(
|
|||||||
* prev middle next
|
* prev middle next
|
||||||
* extend delete delete
|
* extend delete delete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
vmg->start = prev->vm_start;
|
vmg->start = prev->vm_start;
|
||||||
vmg->end = next->vm_end;
|
vmg->end = next->vm_end;
|
||||||
vmg->pgoff = prev->vm_pgoff;
|
vmg->pgoff = vma_start_pgoff(prev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We already ensured anon_vma compatibility above, so now it's
|
* We already ensured anon_vma compatibility above, so now it's
|
||||||
@@ -987,9 +986,8 @@ static __must_check struct vm_area_struct *vma_merge_existing_range(
|
|||||||
* prev middle
|
* prev middle
|
||||||
* extend shrink/delete
|
* extend shrink/delete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
vmg->start = prev->vm_start;
|
vmg->start = prev->vm_start;
|
||||||
vmg->pgoff = prev->vm_pgoff;
|
vmg->pgoff = vma_start_pgoff(prev);
|
||||||
|
|
||||||
if (!vmg->__remove_middle)
|
if (!vmg->__remove_middle)
|
||||||
vmg->__adjust_middle_start = true;
|
vmg->__adjust_middle_start = true;
|
||||||
@@ -1011,13 +1009,13 @@ static __must_check struct vm_area_struct *vma_merge_existing_range(
|
|||||||
|
|
||||||
if (vmg->__remove_middle) {
|
if (vmg->__remove_middle) {
|
||||||
vmg->end = next->vm_end;
|
vmg->end = next->vm_end;
|
||||||
vmg->pgoff = next->vm_pgoff - pglen;
|
vmg->pgoff = vma_start_pgoff(next) - pglen;
|
||||||
} else {
|
} else {
|
||||||
/* We shrink middle and expand next. */
|
/* We shrink middle and expand next. */
|
||||||
vmg->__adjust_next_start = true;
|
vmg->__adjust_next_start = true;
|
||||||
vmg->start = middle->vm_start;
|
vmg->start = middle->vm_start;
|
||||||
vmg->end = start;
|
vmg->end = start;
|
||||||
vmg->pgoff = middle->vm_pgoff;
|
vmg->pgoff = vma_start_pgoff(middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dup_anon_vma(next, middle, &anon_dup);
|
err = dup_anon_vma(next, middle, &anon_dup);
|
||||||
@@ -1126,7 +1124,7 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg)
|
|||||||
if (can_merge_left) {
|
if (can_merge_left) {
|
||||||
vmg->start = prev->vm_start;
|
vmg->start = prev->vm_start;
|
||||||
vmg->target = prev;
|
vmg->target = prev;
|
||||||
vmg->pgoff = prev->vm_pgoff;
|
vmg->pgoff = vma_start_pgoff(prev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this merge would result in removal of the next VMA but we
|
* If this merge would result in removal of the next VMA but we
|
||||||
@@ -1957,7 +1955,8 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
|
|||||||
VM_BUG_ON_VMA(faulted_in_anon_vma, new_vma);
|
VM_BUG_ON_VMA(faulted_in_anon_vma, new_vma);
|
||||||
*vmap = vma = new_vma;
|
*vmap = vma = new_vma;
|
||||||
}
|
}
|
||||||
*need_rmap_locks = (new_vma->vm_pgoff <= vma->vm_pgoff);
|
*need_rmap_locks =
|
||||||
|
(vma_start_pgoff(new_vma) <= vma_start_pgoff(vma));
|
||||||
} else {
|
} else {
|
||||||
new_vma = vm_area_dup(vma);
|
new_vma = vm_area_dup(vma);
|
||||||
if (!new_vma)
|
if (!new_vma)
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ int relocate_vma_down(struct vm_area_struct *vma, unsigned long shift)
|
|||||||
unsigned long new_end = old_end - shift;
|
unsigned long new_end = old_end - shift;
|
||||||
VMA_ITERATOR(vmi, mm, new_start);
|
VMA_ITERATOR(vmi, mm, new_start);
|
||||||
VMG_STATE(vmg, mm, &vmi, new_start, old_end, EMPTY_VMA_FLAGS,
|
VMG_STATE(vmg, mm, &vmi, new_start, old_end, EMPTY_VMA_FLAGS,
|
||||||
vma->vm_pgoff);
|
vma_start_pgoff(vma));
|
||||||
struct vm_area_struct *next;
|
struct vm_area_struct *next;
|
||||||
struct mmu_gather tlb;
|
struct mmu_gather tlb;
|
||||||
PAGETABLE_MOVE(pmc, vma, vma, old_start, new_start, length);
|
PAGETABLE_MOVE(pmc, vma, vma, old_start, new_start, length);
|
||||||
@@ -89,7 +89,7 @@ int relocate_vma_down(struct vm_area_struct *vma, unsigned long shift)
|
|||||||
|
|
||||||
vma_prev(&vmi);
|
vma_prev(&vmi);
|
||||||
/* Shrink the vma to just the new range */
|
/* Shrink the vma to just the new range */
|
||||||
return vma_shrink(&vmi, vma, new_start, new_end, vma->vm_pgoff);
|
return vma_shrink(&vmi, vma, new_start, new_end, vma_start_pgoff(vma));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ static void vm_area_init_from(const struct vm_area_struct *src,
|
|||||||
dest->vm_start = src->vm_start;
|
dest->vm_start = src->vm_start;
|
||||||
dest->vm_end = src->vm_end;
|
dest->vm_end = src->vm_end;
|
||||||
dest->anon_vma = src->anon_vma;
|
dest->anon_vma = src->anon_vma;
|
||||||
dest->vm_pgoff = src->vm_pgoff;
|
dest->vm_pgoff = vma_start_pgoff(src);
|
||||||
dest->vm_file = src->vm_file;
|
dest->vm_file = src->vm_file;
|
||||||
dest->vm_private_data = src->vm_private_data;
|
dest->vm_private_data = src->vm_private_data;
|
||||||
vm_flags_init(dest, src->vm_flags);
|
vm_flags_init(dest, src->vm_flags);
|
||||||
|
|||||||
Reference in New Issue
Block a user