diff options
| author | Mauro Carvalho Chehab <[email protected]> | 2016-10-05 16:42:36 -0300 | 
|---|---|---|
| committer | Mauro Carvalho Chehab <[email protected]> | 2016-10-05 16:43:53 -0300 | 
| commit | 9fce0c226536fc36c7fb0a80000ca38a995be43e (patch) | |
| tree | d1d03d4a831bb143ffd401cefa0f44f636ac0084 /kernel/futex.c | |
| parent | 3cc2691227203c00cac1d82d6b0772224d5c87b2 (diff) | |
| parent | c8d2bc9bc39ebea8437fd974fdbc21847bb897a3 (diff) | |
Merge tag 'v4.8' into patchwork
Linux 4.8
* tag 'v4.8': (1761 commits)
  Linux 4.8
  ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7
  MIPS: CM: Fix mips_cm_max_vp_width for non-MT kernels on MT systems
  include/linux/property.h: fix typo/compile error
  ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()
  mm: workingset: fix crash in shadow node shrinker caused by replace_page_cache_page()
  MAINTAINERS: Switch to kernel.org email address for Javi Merino
  x86/entry/64: Fix context tracking state warning when load_gs_index fails
  x86/boot: Initialize FPU and X86_FEATURE_ALWAYS even if we don't have CPUID
  x86/vdso: Fix building on big endian host
  x86/boot: Fix another __read_cr4() case on 486
  sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock
  sctp: change to check peer prsctp_capable when using prsctp polices
  sctp: remove prsctp_param from sctp_chunk
  sctp: move sent_count to the memory hole in sctp_chunk
  tg3: Avoid NULL pointer dereference in tg3_io_error_detected()
  x86/init: Fix cr4_init_shadow() on CR4-less machines
  MIPS: Fix detection of unsupported highmem with cache aliases
  MIPS: Malta: Fix IOCU disable switch read for MIPS64
  MIPS: Fix BUILD_ROLLBACK_PROLOGUE for microMIPS
  ...
Diffstat (limited to 'kernel/futex.c')
| -rw-r--r-- | kernel/futex.c | 23 | 
1 files changed, 22 insertions, 1 deletions
| diff --git a/kernel/futex.c b/kernel/futex.c index 33664f70e2d2..46cb3a301bc1 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -179,7 +179,15 @@ int __read_mostly futex_cmpxchg_enabled;   * Futex flags used to encode options to functions and preserve them across   * restarts.   */ -#define FLAGS_SHARED		0x01 +#ifdef CONFIG_MMU +# define FLAGS_SHARED		0x01 +#else +/* + * NOMMU does not have per process address space. Let the compiler optimize + * code away. + */ +# define FLAGS_SHARED		0x00 +#endif  #define FLAGS_CLOCKRT		0x02  #define FLAGS_HAS_TIMEOUT	0x04 @@ -405,6 +413,16 @@ static void get_futex_key_refs(union futex_key *key)  	if (!key->both.ptr)  		return; +	/* +	 * On MMU less systems futexes are always "private" as there is no per +	 * process address space. We need the smp wmb nevertheless - yes, +	 * arch/blackfin has MMU less SMP ... +	 */ +	if (!IS_ENABLED(CONFIG_MMU)) { +		smp_mb(); /* explicit smp_mb(); (B) */ +		return; +	} +  	switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {  	case FUT_OFF_INODE:  		ihold(key->shared.inode); /* implies smp_mb(); (B) */ @@ -436,6 +454,9 @@ static void drop_futex_key_refs(union futex_key *key)  		return;  	} +	if (!IS_ENABLED(CONFIG_MMU)) +		return; +  	switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {  	case FUT_OFF_INODE:  		iput(key->shared.inode); |