Commit d528ae0d authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton:
 "6 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  drivers core: remove assert_held_device_hotplug()
  mm: add private lock to serialize memory hotplug operations
  mm: don't warn when vmalloc() fails due to a fatal signal
  mm, x86: fix native_pud_clear build error
  kasan: add a prototype of task_struct to avoid warning
  z3fold: fix spinlock unlocking in page reclaim
parents d11507e1 15c9e10d
...@@ -121,12 +121,9 @@ static inline void native_pmd_clear(pmd_t *pmd) ...@@ -121,12 +121,9 @@ static inline void native_pmd_clear(pmd_t *pmd)
*(tmp + 1) = 0; *(tmp + 1) = 0;
} }
#if !defined(CONFIG_SMP) || (defined(CONFIG_HIGHMEM64G) && \
defined(CONFIG_PARAVIRT))
static inline void native_pud_clear(pud_t *pudp) static inline void native_pud_clear(pud_t *pudp)
{ {
} }
#endif
static inline void pud_clear(pud_t *pudp) static inline void pud_clear(pud_t *pudp)
{ {
......
...@@ -62,7 +62,7 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page); ...@@ -62,7 +62,7 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);
# define set_pud(pudp, pud) native_set_pud(pudp, pud) # define set_pud(pudp, pud) native_set_pud(pudp, pud)
#endif #endif
#ifndef __PAGETABLE_PMD_FOLDED #ifndef __PAGETABLE_PUD_FOLDED
#define pud_clear(pud) native_pud_clear(pud) #define pud_clear(pud) native_pud_clear(pud)
#endif #endif
......
...@@ -639,11 +639,6 @@ int lock_device_hotplug_sysfs(void) ...@@ -639,11 +639,6 @@ int lock_device_hotplug_sysfs(void)
return restart_syscall(); return restart_syscall();
} }
void assert_held_device_hotplug(void)
{
lockdep_assert_held(&device_hotplug_lock);
}
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static inline int device_is_not_partition(struct device *dev) static inline int device_is_not_partition(struct device *dev)
{ {
......
...@@ -1140,7 +1140,6 @@ static inline bool device_supports_offline(struct device *dev) ...@@ -1140,7 +1140,6 @@ static inline bool device_supports_offline(struct device *dev)
extern void lock_device_hotplug(void); extern void lock_device_hotplug(void);
extern void unlock_device_hotplug(void); extern void unlock_device_hotplug(void);
extern int lock_device_hotplug_sysfs(void); extern int lock_device_hotplug_sysfs(void);
void assert_held_device_hotplug(void);
extern int device_offline(struct device *dev); extern int device_offline(struct device *dev);
extern int device_online(struct device *dev); extern int device_online(struct device *dev);
extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
struct kmem_cache; struct kmem_cache;
struct page; struct page;
struct vm_struct; struct vm_struct;
struct task_struct;
#ifdef CONFIG_KASAN #ifdef CONFIG_KASAN
......
...@@ -247,11 +247,9 @@ static void devm_memremap_pages_release(struct device *dev, void *data) ...@@ -247,11 +247,9 @@ static void devm_memremap_pages_release(struct device *dev, void *data)
align_start = res->start & ~(SECTION_SIZE - 1); align_start = res->start & ~(SECTION_SIZE - 1);
align_size = ALIGN(resource_size(res), SECTION_SIZE); align_size = ALIGN(resource_size(res), SECTION_SIZE);
lock_device_hotplug();
mem_hotplug_begin(); mem_hotplug_begin();
arch_remove_memory(align_start, align_size); arch_remove_memory(align_start, align_size);
mem_hotplug_done(); mem_hotplug_done();
unlock_device_hotplug();
untrack_pfn(NULL, PHYS_PFN(align_start), align_size); untrack_pfn(NULL, PHYS_PFN(align_start), align_size);
pgmap_radix_release(res); pgmap_radix_release(res);
...@@ -364,11 +362,9 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, ...@@ -364,11 +362,9 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
if (error) if (error)
goto err_pfn_remap; goto err_pfn_remap;
lock_device_hotplug();
mem_hotplug_begin(); mem_hotplug_begin();
error = arch_add_memory(nid, align_start, align_size, true); error = arch_add_memory(nid, align_start, align_size, true);
mem_hotplug_done(); mem_hotplug_done();
unlock_device_hotplug();
if (error) if (error)
goto err_add_memory; goto err_add_memory;
......
...@@ -125,9 +125,12 @@ void put_online_mems(void) ...@@ -125,9 +125,12 @@ void put_online_mems(void)
} }
/* Serializes write accesses to mem_hotplug.active_writer. */
static DEFINE_MUTEX(memory_add_remove_lock);
void mem_hotplug_begin(void) void mem_hotplug_begin(void)
{ {
assert_held_device_hotplug(); mutex_lock(&memory_add_remove_lock);
mem_hotplug.active_writer = current; mem_hotplug.active_writer = current;
...@@ -147,6 +150,7 @@ void mem_hotplug_done(void) ...@@ -147,6 +150,7 @@ void mem_hotplug_done(void)
mem_hotplug.active_writer = NULL; mem_hotplug.active_writer = NULL;
mutex_unlock(&mem_hotplug.lock); mutex_unlock(&mem_hotplug.lock);
memhp_lock_release(); memhp_lock_release();
mutex_unlock(&memory_add_remove_lock);
} }
/* add this memory to iomem resource */ /* add this memory to iomem resource */
......
...@@ -1683,7 +1683,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, ...@@ -1683,7 +1683,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
if (fatal_signal_pending(current)) { if (fatal_signal_pending(current)) {
area->nr_pages = i; area->nr_pages = i;
goto fail; goto fail_no_warn;
} }
if (node == NUMA_NO_NODE) if (node == NUMA_NO_NODE)
...@@ -1709,6 +1709,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, ...@@ -1709,6 +1709,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
warn_alloc(gfp_mask, NULL, warn_alloc(gfp_mask, NULL,
"vmalloc: allocation failure, allocated %ld of %ld bytes", "vmalloc: allocation failure, allocated %ld of %ld bytes",
(area->nr_pages*PAGE_SIZE), area->size); (area->nr_pages*PAGE_SIZE), area->size);
fail_no_warn:
vfree(area->addr); vfree(area->addr);
return NULL; return NULL;
} }
......
...@@ -667,6 +667,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) ...@@ -667,6 +667,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
z3fold_page_unlock(zhdr); z3fold_page_unlock(zhdr);
spin_lock(&pool->lock); spin_lock(&pool->lock);
if (kref_put(&zhdr->refcount, release_z3fold_page)) { if (kref_put(&zhdr->refcount, release_z3fold_page)) {
spin_unlock(&pool->lock);
atomic64_dec(&pool->pages_nr); atomic64_dec(&pool->pages_nr);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment