cregit-Linux how code gets into the kernel

Release 4.16 include/linux/mman.h

Directory: include/linux
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_MMAN_H

#define _LINUX_MMAN_H

#include <linux/mm.h>
#include <linux/percpu_counter.h>

#include <linux/atomic.h>
#include <uapi/linux/mman.h>

/*
 * Arrange for legacy / undefined architecture specific flags to be
 * ignored by mmap handling code.
 */
#ifndef MAP_32BIT

#define MAP_32BIT 0
#endif
#ifndef MAP_HUGE_2MB

#define MAP_HUGE_2MB 0
#endif
#ifndef MAP_HUGE_1GB

#define MAP_HUGE_1GB 0
#endif
#ifndef MAP_UNINITIALIZED

#define MAP_UNINITIALIZED 0
#endif
#ifndef MAP_SYNC

#define MAP_SYNC 0
#endif

/*
 * The historical set of flags that all mmap implementations implicitly
 * support when a ->mmap_validate() op is not provided in file_operations.
 */

#define LEGACY_MAP_MASK (MAP_SHARED \
                | MAP_PRIVATE \
                | MAP_FIXED \
                | MAP_ANONYMOUS \
                | MAP_DENYWRITE \
                | MAP_EXECUTABLE \
                | MAP_UNINITIALIZED \
                | MAP_GROWSDOWN \
                | MAP_LOCKED \
                | MAP_NORESERVE \
                | MAP_POPULATE \
                | MAP_NONBLOCK \
                | MAP_STACK \
                | MAP_HUGETLB \
                | MAP_32BIT \
                | MAP_HUGE_2MB \
                | MAP_HUGE_1GB)

extern int sysctl_overcommit_memory;
extern int sysctl_overcommit_ratio;
extern unsigned long sysctl_overcommit_kbytes;
extern struct percpu_counter vm_committed_as;

#ifdef CONFIG_SMP
extern s32 vm_committed_as_batch;
#else

#define vm_committed_as_batch 0
#endif

unsigned long vm_memory_committed(void);


static inline void vm_acct_memory(long pages) { percpu_counter_add_batch(&vm_committed_as, pages, vm_committed_as_batch); }

Contributors

PersonTokensPropCommitsCommitProp
Andrew Morton1470.00%125.00%
Motohiro Kosaki315.00%125.00%
Tim Chen210.00%125.00%
Nikolay Borisov15.00%125.00%
Total20100.00%4100.00%


static inline void vm_unacct_memory(long pages) { vm_acct_memory(-pages); }

Contributors

PersonTokensPropCommitsCommitProp
Andrew Morton16100.00%1100.00%
Total16100.00%1100.00%

/* * Allow architectures to handle additional protection bits */ #ifndef arch_calc_vm_prot_bits #define arch_calc_vm_prot_bits(prot, pkey) 0 #endif #ifndef arch_vm_get_page_prot #define arch_vm_get_page_prot(vm_flags) __pgprot(0) #endif #ifndef arch_validate_prot /* * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have * already been masked out. * * Returns true if the prot flags are valid */
static inline bool arch_validate_prot(unsigned long prot) { return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Kleikamp2896.55%150.00%
Chen Gang S13.45%150.00%
Total29100.00%2100.00%

#define arch_validate_prot arch_validate_prot #endif /* * Optimisation macro. It is equivalent to: * (x & bit1) ? bit2 : 0 * but this version is faster. * ("bit1" and "bit2" must be single bits) */ #define _calc_vm_trans(x, bit1, bit2) \ ((!(bit1) || !(bit2)) ? 0 : \ ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ : ((x) & (bit1)) / ((bit1) / (bit2)))) /* * Combine the mmap "prot" argument into "vm_flags" used internally. */
static inline unsigned long calc_vm_prot_bits(unsigned long prot, unsigned long pkey) { return _calc_vm_trans(prot, PROT_READ, VM_READ ) | _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) | _calc_vm_trans(prot, PROT_EXEC, VM_EXEC) | arch_calc_vm_prot_bits(prot, pkey); }

Contributors

PersonTokensPropCommitsCommitProp
Jamie Lokier4078.43%133.33%
Dave Hansen611.76%133.33%
Dave Kleikamp59.80%133.33%
Total51100.00%3100.00%

/* * Combine the mmap "flags" argument into "vm_flags" used internally. */
static inline unsigned long calc_vm_flag_bits(unsigned long flags) { return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) | _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ); }

Contributors

PersonTokensPropCommitsCommitProp
Jamie Lokier3571.43%133.33%
Jan Kara918.37%133.33%
Michel Lespinasse510.20%133.33%
Total49100.00%3100.00%

unsigned long vm_commit_limit(void); #endif /* _LINUX_MMAN_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Jamie Lokier8826.11%14.35%
Dave Kleikamp6820.18%14.35%
Andrew Morton4112.17%417.39%
Dan J Williams4112.17%14.35%
Jan Kara205.93%28.70%
Tim Chen175.04%14.35%
Jerome Marchand123.56%28.70%
Linus Torvalds (pre-git)113.26%28.70%
Dave Hansen82.37%14.35%
Motohiro Kosaki82.37%14.35%
K. Y. Srinivasan72.08%14.35%
Michel Lespinasse51.48%14.35%
David Howells41.19%14.35%
David Woodhouse41.19%14.35%
Greg Kroah-Hartman10.30%14.35%
Chen Gang S10.30%14.35%
Nikolay Borisov10.30%14.35%
Total337100.00%23100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.