]> git.karo-electronics.de Git - linux-beck.git/blobdiff - arch/s390/mm/pgtable.c
mm, shmem: add internal shmem resident memory accounting
[linux-beck.git] / arch / s390 / mm / pgtable.c
index 54ef3bc01b43c361a47d6a9112b9bb7bfcdc4501..aa34af0a0b263a13940b5de0f26cb4aef3ef966c 100644 (file)
@@ -133,7 +133,7 @@ void crst_table_downgrade(struct mm_struct *mm, unsigned long limit)
 /**
  * gmap_alloc - allocate a guest address space
  * @mm: pointer to the parent mm_struct
- * @limit: maximum size of the gmap address space
+ * @limit: maximum address of the gmap address space
  *
  * Returns a guest address space structure.
  */
@@ -402,7 +402,7 @@ int gmap_map_segment(struct gmap *gmap, unsigned long from,
        if ((from | to | len) & (PMD_SIZE - 1))
                return -EINVAL;
        if (len == 0 || from + len < from || to + len < to ||
-           from + len > TASK_MAX_SIZE || to + len > gmap->asce_end)
+           from + len - 1 > TASK_MAX_SIZE || to + len - 1 > gmap->asce_end)
                return -EINVAL;
 
        flush = 0;
@@ -603,10 +603,7 @@ static void gmap_zap_swap_entry(swp_entry_t entry, struct mm_struct *mm)
        else if (is_migration_entry(entry)) {
                struct page *page = migration_entry_to_page(entry);
 
-               if (PageAnon(page))
-                       dec_mm_counter(mm, MM_ANONPAGES);
-               else
-                       dec_mm_counter(mm, MM_FILEPAGES);
+               dec_mm_counter(mm, mm_counter(page));
        }
        free_swap_and_cache(entry);
 }