summaryrefslogtreecommitdiffstats
path: root/scripts/recordmcount.h
AgeCommit message (Expand)Author
2014-06-26recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modulesAlex Smith
2012-08-23ftrace: Make recordmcount.c handle __fentry__Steven Rostedt
2012-01-06recordmcount: Fix handling of elf64 big-endian objects.David Daney
2011-05-25ftrace/recordmcount: Avoid STT_FUNC symbols as base on ARMRabin Vincent
2011-05-16ftrace/recordmcount: mcount address adjustmentMartin Schwidefsky
2011-05-16ftrace/recordmcount: Add helper function get_sym_str_and_relp()Steven Rostedt
2011-05-16ftrace/recordmcount: Remove duplicate code to find mcount symbolSteven Rostedt
2011-05-16ftrace/recordmcount: Add warning logic to warn on mcount not recordedSteven Rostedt
2011-05-16ftrace/recordmcount: Make ignored mcount calls into nops at compile timeSteven Rostedt
2011-05-16ftrace/recordmcount: Modify only executable sectionsSteven Rostedt
2011-05-16ftrace/trivial: Clean up recordmcount.c to use Linux style comparisonsSteven Rostedt
2011-01-05Merge branches 'ftrace', 'gic', 'io', 'kexec', 'mod', 'sa11x0', 'sh' and 'ver...Russell King
2010-12-04ARM: 6511/1: ftrace: add ARM support for C version of recordmcountRabin Vincent
2010-12-02ftrace: Have recordmcount honor endianness in fn_ELF_R_INFOJohn Reiser
2010-10-29ftrace/MIPS: Add module support for C version of recordmcountWu Zhangjin
2010-10-29ftrace/MIPS: Add MIPS64 support for C version of recordmcountJohn Reiser
2010-10-14ftrace: Remove duplicate code for 64 and 32 bit in recordmcount.cSteven Rostedt
.13/base'>v5.13/base Yocto Linux Embedded kernelGrokmirror user
summaryrefslogtreecommitdiffstats
path: root/fs/drop_caches.c
blob: 5718cb9f7273e83a2fe6c7775dcf76c636dd908a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Implement the manual drop-all-pagecache function
 */

#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/writeback.h>
#include <linux/sysctl.h>
#include <linux/gfp.h>
#include "internal.h"

/* A global variable is a bit ugly, but it keeps the code simple */
int sysctl_drop_caches;

static void drop_pagecache_sb(struct super_block *sb, void *unused)
{
	struct inode *inode, *toput_inode = NULL;

	spin_lock(&inode_sb_list_lock);
	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
		spin_lock(&inode->i_lock);
		if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) ||
		    (inode->i_mapping->nrpages == 0)) {
			spin_unlock(&inode->i_lock);
			continue;
		}
		__iget(inode);
		spin_unlock(&inode->i_lock);
		spin_unlock(&inode_sb_list_lock);
		invalidate_mapping_pages(inode->i_mapping, 0, -1);
		iput(toput_inode);
		toput_inode = inode;
		spin_lock(&inode_sb_list_lock);
	}
	spin_unlock(&inode_sb_list_lock);
	iput(toput_inode);
}

int drop_caches_sysctl_handler(struct ctl_table *table, int write,
	void __user *buffer, size_t *length, loff_t *ppos)
{
	int ret;

	ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
	if (ret)
		return ret;
	if (write) {
		static int stfu;

		if (sysctl_drop_caches & 1) {
			iterate_supers(drop_pagecache_sb, NULL);
			count_vm_event(DROP_PAGECACHE);
		}
		if (sysctl_drop_caches & 2) {
			drop_slab();
			count_vm_event(DROP_SLAB);
		}
		if (!stfu) {
			pr_info("%s (%d): drop_caches: %d\n",
				current->comm, task_pid_nr(current),
				sysctl_drop_caches);
		}
		stfu |= sysctl_drop_caches & 4;
	}
	return 0;
}