Skip to content

Commit

Permalink
Merge branch 'mm-everything' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/akpm/mm

# Conflicts:
#	Documentation/translations/zh_CN/accounting/delay-accounting.rst
#	include/linux/memcontrol.h
#	mm/filemap.c
#	mm/memcontrol.c
  • Loading branch information
Stephen Rothwell committed Feb 17, 2023
2 parents 8bd7004 + fba720c commit d3f6d57
Show file tree
Hide file tree
Showing 54 changed files with 2,046 additions and 1,056 deletions.
14 changes: 7 additions & 7 deletions Documentation/accounting/delay-accounting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ Get sum of delays, since system boot, for all pids with tgid 5::
CPU count real total virtual total delay total delay average
8 7000000 6872122 3382277 0.423ms
IO count delay total delay average
0 0 0ms
0 0 0.000ms
SWAP count delay total delay average
0 0 0ms
0 0 0.000ms
RECLAIM count delay total delay average
0 0 0ms
0 0 0.000ms
THRASHING count delay total delay average
0 0 0ms
0 0 0.000ms
COMPACT count delay total delay average
0 0 0ms
WPCOPY count delay total delay average
0 0 0ms
0 0 0.000ms
WPCOPY count delay total delay average
0 0 0.000ms

Get IO accounting for pid 1, it works only with -p::

Expand Down
7 changes: 7 additions & 0 deletions Documentation/admin-guide/mm/ksm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ stable_node_chains
the number of KSM pages that hit the ``max_page_sharing`` limit
stable_node_dups
number of duplicated KSM pages
zero_pages_sharing
how many empty pages are sharing kernel zero page(s) instead of
with each other as it would happen normally. Only effective when
enabling ``use_zero_pages`` knob.

When enabling ``use_zero_pages``, the sum of ``pages_sharing`` +
``zero_pages_sharing`` represents how much really saved by KSM.

A high ratio of ``pages_sharing`` to ``pages_shared`` indicates good
sharing, but a high ratio of ``pages_unshared`` to ``pages_sharing``
Expand Down
14 changes: 7 additions & 7 deletions Documentation/translations/zh_CN/accounting/delay-accounting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ getdelays命令的一般格式::
CPU count real total virtual total delay total delay average
8 7000000 6872122 3382277 0.423ms
IO count delay total delay average
0 0 0ms
0 0 0.000ms
SWAP count delay total delay average
0 0 0ms
0 0 0.000ms
RECLAIM count delay total delay average
0 0 0ms
0 0 0.000ms
THRASHING count delay total delay average
0 0 0ms
0 0 0.000ms
COMPACT count delay total delay average
0 0 0ms
WPCOPY count delay total delay average
0 0 0ms
0 0 0.000ms
WPCOPY count delay total delay average
0 0 0.000ms

获取pid为1的IO计数,它只和-p一起使用::
# ./getdelays -i -p 1
Expand Down
2 changes: 2 additions & 0 deletions arch/m68k/include/asm/page_no.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ extern unsigned long memory_end;
#define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET) && \
((unsigned long)(kaddr) < memory_end))

#define ARCH_PFN_OFFSET PHYS_PFN(PAGE_OFFSET_RAW)

#endif /* __ASSEMBLY__ */

#endif /* _M68K_PAGE_NO_H */
1 change: 1 addition & 0 deletions arch/sh/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ void __init paging_init(void)
*/
max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
set_max_mapnr(max_low_pfn - min_low_pfn);

nodes_clear(node_online_map);

Expand Down
7 changes: 7 additions & 0 deletions fs/nilfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,14 @@ static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)

minseg = range[0] + segbytes - 1;
do_div(minseg, segbytes);

if (range[1] < 4096)
goto out;

maxseg = NILFS_SB2_OFFSET_BYTES(range[1]);
if (maxseg < segbytes)
goto out;

do_div(maxseg, segbytes);
maxseg--;

Expand Down
9 changes: 9 additions & 0 deletions fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,15 @@ int nilfs_resize_fs(struct super_block *sb, __u64 newsize)
if (newsize > devsize)
goto out;

/*
* Prevent underflow in second superblock position calculation.
* The exact minimum size check is done in nilfs_sufile_resize().
*/
if (newsize < 4096) {
ret = -ENOSPC;
goto out;
}

/*
* Write lock is required to protect some functions depending
* on the number of segments, the number of reserved segments,
Expand Down
8 changes: 7 additions & 1 deletion fs/nilfs2/the_nilfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,15 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
{
struct nilfs_super_block **sbp = nilfs->ns_sbp;
struct buffer_head **sbh = nilfs->ns_sbh;
u64 sb2off = NILFS_SB2_OFFSET_BYTES(bdev_nr_bytes(nilfs->ns_bdev));
u64 sb2off, devsize = bdev_nr_bytes(nilfs->ns_bdev);
int valid[2], swp = 0;

if (devsize < NILFS_SEG_MIN_BLOCKS * NILFS_MIN_BLOCK_SIZE + 4096) {
nilfs_err(sb, "device size too small");
return -EINVAL;
}
sb2off = NILFS_SB2_OFFSET_BYTES(devsize);

sbp[0] = nilfs_read_super_block(sb, NILFS_SB_OFFSET_BYTES, blocksize,
&sbh[0]);
sbp[1] = nilfs_read_super_block(sb, sb2off, blocksize, &sbh[1]);
Expand Down
1 change: 1 addition & 0 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,7 @@ static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
mm = get_task_mm(task);
if (mm) {
seq_printf(m, "ksm_rmap_items %lu\n", mm->ksm_rmap_items);
seq_printf(m, "zero_pages_sharing %lu\n", mm->ksm_zero_pages_sharing);
mmput(mm);
}

Expand Down
11 changes: 7 additions & 4 deletions include/linux/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to,
vm_flags_t vm_flags);
long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
long freed);
int isolate_hugetlb(struct folio *folio, struct list_head *list);
bool isolate_hugetlb(struct folio *folio, struct list_head *list);
int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison);
int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
bool *migratable_cleared);
Expand Down Expand Up @@ -413,9 +413,9 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
return NULL;
}

static inline int isolate_hugetlb(struct folio *folio, struct list_head *list)
static inline bool isolate_hugetlb(struct folio *folio, struct list_head *list)
{
return -EBUSY;
return false;
}

static inline int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison)
Expand Down Expand Up @@ -781,7 +781,10 @@ static inline struct hstate *hstate_sizelog(int page_size_log)
if (!page_size_log)
return &default_hstate;

return size_to_hstate(1UL << page_size_log);
if (page_size_log < BITS_PER_LONG)
return size_to_hstate(1UL << page_size_log);

return NULL;
}

static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
Expand Down
14 changes: 7 additions & 7 deletions include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -1782,24 +1782,24 @@ static inline bool memcg_bpf_enabled(void)
return static_branch_likely(&memcg_bpf_enabled_key);
}

extern struct static_key_false memcg_kmem_enabled_key;
extern struct static_key_false memcg_kmem_online_key;

static inline bool memcg_kmem_enabled(void)
static inline bool memcg_kmem_online(void)
{
return static_branch_likely(&memcg_kmem_enabled_key);
return static_branch_likely(&memcg_kmem_online_key);
}

static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
int order)
{
if (memcg_kmem_enabled())
if (memcg_kmem_online())
return __memcg_kmem_charge_page(page, gfp, order);
return 0;
}

static inline void memcg_kmem_uncharge_page(struct page *page, int order)
{
if (memcg_kmem_enabled())
if (memcg_kmem_online())
__memcg_kmem_uncharge_page(page, order);
}

Expand All @@ -1820,7 +1820,7 @@ static inline void count_objcg_event(struct obj_cgroup *objcg,
{
struct mem_cgroup *memcg;

if (!memcg_kmem_enabled())
if (!memcg_kmem_online())
return;

rcu_read_lock();
Expand Down Expand Up @@ -1865,7 +1865,7 @@ static inline bool memcg_bpf_enabled(void)
return false;
}

static inline bool memcg_kmem_enabled(void)
static inline bool memcg_kmem_online(void)
{
return false;
}
Expand Down
21 changes: 11 additions & 10 deletions include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct migration_target_control;
* - zero on page migration success;
*/
#define MIGRATEPAGE_SUCCESS 0
#define MIGRATEPAGE_UNMAP 1

/**
* struct movable_operations - Driver page migration
Expand Down Expand Up @@ -61,16 +62,16 @@ extern const char *migrate_reason_names[MR_TYPES];

#ifdef CONFIG_MIGRATION

extern void putback_movable_pages(struct list_head *l);
void putback_movable_pages(struct list_head *l);
int migrate_folio_extra(struct address_space *mapping, struct folio *dst,
struct folio *src, enum migrate_mode mode, int extra_count);
int migrate_folio(struct address_space *mapping, struct folio *dst,
struct folio *src, enum migrate_mode mode);
extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
unsigned long private, enum migrate_mode mode, int reason,
unsigned int *ret_succeeded);
extern struct page *alloc_migration_target(struct page *page, unsigned long private);
extern int isolate_movable_page(struct page *page, isolate_mode_t mode);
int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
unsigned long private, enum migrate_mode mode, int reason,
unsigned int *ret_succeeded);
struct page *alloc_migration_target(struct page *page, unsigned long private);
bool isolate_movable_page(struct page *page, isolate_mode_t mode);

int migrate_huge_page_move_mapping(struct address_space *mapping,
struct folio *dst, struct folio *src);
Expand All @@ -91,8 +92,8 @@ static inline int migrate_pages(struct list_head *l, new_page_t new,
static inline struct page *alloc_migration_target(struct page *page,
unsigned long private)
{ return NULL; }
static inline int isolate_movable_page(struct page *page, isolate_mode_t mode)
{ return -EBUSY; }
static inline bool isolate_movable_page(struct page *page, isolate_mode_t mode)
{ return false; }

static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
struct folio *dst, struct folio *src)
Expand Down Expand Up @@ -141,8 +142,8 @@ const struct movable_operations *page_movable_ops(struct page *page)
}

#ifdef CONFIG_NUMA_BALANCING
extern int migrate_misplaced_page(struct page *page,
struct vm_area_struct *vma, int node);
int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
int node);
#else
static inline int migrate_misplaced_page(struct page *page,
struct vm_area_struct *vma, int node)
Expand Down
7 changes: 6 additions & 1 deletion include/linux/mm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,14 +740,19 @@ struct mm_struct {
#ifdef CONFIG_KSM
/*
* Represent how many pages of this process are involved in KSM
* merging.
* merging (not including ksm_zero_pages_sharing).
*/
unsigned long ksm_merging_pages;
/*
* Represent how many pages are checked for ksm merging
* including merged and not merged.
*/
unsigned long ksm_rmap_items;
/*
* Represent how many empty pages are merged with kernel zero
* pages when enabling KSM use_zero_pages.
*/
unsigned long ksm_zero_pages_sharing;
#endif
#ifdef CONFIG_LRU_GEN
struct {
Expand Down
Loading

0 comments on commit d3f6d57

Please sign in to comment.