Commit 19788a90 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (patches from Andrew Morton)

Merge more patches from Andrew Morton:
 "A bunch of fixes.

  Plus Joe's printk move and rework.  It's not a -rc3 thing but now
  would be a nice time to offload it, while things are quiet.  I've been
  sitting on it all for a couple of weeks, no issues"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  vmpressure: make sure there are no events queued after memcg is offlined
  vmpressure: do not check for pending work to prevent from new work
  vmpressure: change vmpressure::sr_lock to spinlock
  printk: rename struct log to struct printk_log
  printk: use pointer for console_cmdline indexing
  printk: move braille console support into separate braille.[ch] files
  printk: add console_cmdline.h
  printk: move to separate directory for easier modification
  drivers/rtc/rtc-twl.c: fix: rtcX/wakealarm attribute isn't created
  mm: zbud: fix condition check on allocation size
  thp, mm: avoid PageUnevictable on active/inactive lru lists
  mm/swap.c: clear PageActive before adding pages onto unevictable list
  arch/x86/platform/ce4100/ce4100.c: include reboot.h
  mm: sched: numa: fix NUMA balancing when !SCHED_DEBUG
  rapidio: fix use after free in rio_unregister_scan()
  .gitignore: ignore *.lz4 files
  MAINTAINERS: dynamic debug: Jason's not there...
  dmi_scan: add comments on dmi_present() and the loop in dmi_scan_machine()
  ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
  mm: mempolicy: fix mbind_range() && vma_adjust() interaction
parents 06693f30 33cb876e
...@@ -29,6 +29,7 @@ modules.builtin ...@@ -29,6 +29,7 @@ modules.builtin
*.bz2 *.bz2
*.lzma *.lzma
*.xz *.xz
*.lz4
*.lzo *.lzo
*.patch *.patch
*.gcno *.gcno
......
...@@ -84,7 +84,7 @@ X!Iinclude/linux/kobject.h ...@@ -84,7 +84,7 @@ X!Iinclude/linux/kobject.h
<sect1><title>Kernel utility functions</title> <sect1><title>Kernel utility functions</title>
!Iinclude/linux/kernel.h !Iinclude/linux/kernel.h
!Ekernel/printk.c !Ekernel/printk/printk.c
!Ekernel/panic.c !Ekernel/panic.c
!Ekernel/sys.c !Ekernel/sys.c
!Ekernel/rcupdate.c !Ekernel/rcupdate.c
......
...@@ -2871,7 +2871,7 @@ F: drivers/media/usb/dvb-usb-v2/dvb_usb* ...@@ -2871,7 +2871,7 @@ F: drivers/media/usb/dvb-usb-v2/dvb_usb*
F: drivers/media/usb/dvb-usb-v2/usb_urb.c F: drivers/media/usb/dvb-usb-v2/usb_urb.c
DYNAMIC DEBUG DYNAMIC DEBUG
M: Jason Baron <jbaron@redhat.com> M: Jason Baron <jbaron@akamai.com>
S: Maintained S: Maintained
F: lib/dynamic_debug.c F: lib/dynamic_debug.c
F: include/linux/dynamic_debug.h F: include/linux/dynamic_debug.h
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/reboot.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/reboot.h> #include <linux/reboot.h>
......
...@@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index, ...@@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index,
char *console_options, char *braille_options) char *console_options, char *braille_options)
{ {
int ret; int ret;
if (!(console->flags & CON_BRL))
return 0;
if (!console_options) if (!console_options)
/* Only support VisioBraille for now */ /* Only support VisioBraille for now */
console_options = "57600o8"; console_options = "57600o8";
...@@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index, ...@@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index,
braille_co = console; braille_co = console;
register_keyboard_notifier(&keyboard_notifier_block); register_keyboard_notifier(&keyboard_notifier_block);
register_vt_notifier(&vt_notifier_block); register_vt_notifier(&vt_notifier_block);
return 0; return 1;
} }
int braille_unregister_console(struct console *console) int braille_unregister_console(struct console *console)
{ {
if (braille_co != console) if (braille_co != console)
return -EINVAL; return -EINVAL;
if (!(console->flags & CON_BRL))
return 0;
unregister_keyboard_notifier(&keyboard_notifier_block); unregister_keyboard_notifier(&keyboard_notifier_block);
unregister_vt_notifier(&vt_notifier_block); unregister_vt_notifier(&vt_notifier_block);
braille_co = NULL; braille_co = NULL;
return 0; return 1;
} }
...@@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) ...@@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len)
dmi_get_system_info(DMI_BIOS_DATE)); dmi_get_system_info(DMI_BIOS_DATE));
} }
/*
* Check for DMI/SMBIOS headers in the system firmware image. Any
* SMBIOS header must start 16 bytes before the DMI header, so take a
* 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset
* 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS
* takes precedence) and return 0. Otherwise return 1.
*/
static int __init dmi_present(const u8 *buf) static int __init dmi_present(const u8 *buf)
{ {
int smbios_ver; int smbios_ver;
...@@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) ...@@ -506,6 +513,13 @@ void __init dmi_scan_machine(void)
if (p == NULL) if (p == NULL)
goto error; goto error;
/*
* Iterate over all possible DMI header addresses q.
* Maintain the 32 bytes around q in buf. On the
* first iteration, substitute zero for the
* out-of-range bytes so there is no chance of falsely
* detecting an SMBIOS header.
*/
memset(buf, 0, 16); memset(buf, 0, 16);
for (q = p; q < p + 0x10000; q += 16) { for (q = p; q < p + 0x10000; q += 16) {
memcpy_fromio(buf + 16, q, 16); memcpy_fromio(buf + 16, q, 16);
......
...@@ -1715,10 +1715,12 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops) ...@@ -1715,10 +1715,12 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops)
(mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops))
port->nscan = NULL; port->nscan = NULL;
list_for_each_entry(scan, &rio_scans, node) list_for_each_entry(scan, &rio_scans, node) {
if (scan->mport_id == mport_id) { if (scan->mport_id == mport_id) {
list_del(&scan->node); list_del(&scan->node);
kfree(scan); kfree(scan);
break;
}
} }
mutex_unlock(&rio_mport_list_lock); mutex_unlock(&rio_mport_list_lock);
......
...@@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev) ...@@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto out1; goto out1;
device_init_wakeup(&pdev->dev, 1);
rtc = rtc_device_register(pdev->name, rtc = rtc_device_register(pdev->name,
&pdev->dev, &twl_rtc_ops, THIS_MODULE); &pdev->dev, &twl_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) { if (IS_ERR(rtc)) {
...@@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev) ...@@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev)
} }
platform_set_drvdata(pdev, rtc); platform_set_drvdata(pdev, rtc);
device_init_wakeup(&pdev->dev, 1);
return 0; return 0;
out2: out2:
......
...@@ -2965,6 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, ...@@ -2965,6 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
to = map_end & (PAGE_CACHE_SIZE - 1); to = map_end & (PAGE_CACHE_SIZE - 1);
page = find_or_create_page(mapping, page_index, GFP_NOFS); page = find_or_create_page(mapping, page_index, GFP_NOFS);
if (!page) {
ret = -ENOMEM;
mlog_errno(ret);
break;
}
/* /*
* In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
......
...@@ -12,7 +12,7 @@ struct vmpressure { ...@@ -12,7 +12,7 @@ struct vmpressure {
unsigned long scanned; unsigned long scanned;
unsigned long reclaimed; unsigned long reclaimed;
/* The lock is used to keep the scanned/reclaimed above in sync. */ /* The lock is used to keep the scanned/reclaimed above in sync. */
struct mutex sr_lock; struct spinlock sr_lock;
/* The list of vmpressure_event structs. */ /* The list of vmpressure_event structs. */
struct list_head events; struct list_head events;
...@@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, ...@@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
extern void vmpressure_init(struct vmpressure *vmpr); extern void vmpressure_init(struct vmpressure *vmpr);
extern void vmpressure_cleanup(struct vmpressure *vmpr);
extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
obj-y = fork.o exec_domain.o panic.o printk.o \ obj-y = fork.o exec_domain.o panic.o \
cpu.o exit.o itimer.o time.o softirq.o resource.o \ cpu.o exit.o itimer.o time.o softirq.o resource.o \
sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \
signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ signal.o sys.o kmod.o workqueue.o pid.o task_work.o \
...@@ -24,6 +24,7 @@ endif ...@@ -24,6 +24,7 @@ endif
obj-y += sched/ obj-y += sched/
obj-y += power/ obj-y += power/
obj-y += printk/
obj-y += cpu/ obj-y += cpu/
obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o
......
obj-y = printk.o
obj-$(CONFIG_A11Y_BRAILLE_CONSOLE) += braille.o
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/console.h>
#include <linux/string.h>
#include "console_cmdline.h"
#include "braille.h"
char *_braille_console_setup(char **str, char **brl_options)
{
if (!memcmp(*str, "brl,", 4)) {
*brl_options = "";
*str += 4;
} else if (!memcmp(str, "brl=", 4)) {
*brl_options = *str + 4;
*str = strchr(*brl_options, ',');
if (!*str)
pr_err("need port name after brl=\n");
else
*((*str)++) = 0;
}
return *str;
}
int
_braille_register_console(struct console *console, struct console_cmdline *c)
{
int rtn = 0;
if (c->brl_options) {
console->flags |= CON_BRL;
rtn = braille_register_console(console, c->index, c->options,
c->brl_options);
}
return rtn;
}
int
_braille_unregister_console(struct console *console)
{
if (console->flags & CON_BRL)
return braille_unregister_console(console);
return 0;
}
#ifndef _PRINTK_BRAILLE_H
#define _PRINTK_BRAILLE_H
#ifdef CONFIG_A11Y_BRAILLE_CONSOLE
static inline void
braille_set_options(struct console_cmdline *c, char *brl_options)
{
c->brl_options = brl_options;
}
char *
_braille_console_setup(char **str, char **brl_options);
int
_braille_register_console(struct console *console, struct console_cmdline *c);
int
_braille_unregister_console(struct console *console);
#else
static inline void
braille_set_options(struct console_cmdline *c, char *brl_options)
{
}
static inline char *
_braille_console_setup(char **str, char **brl_options)
{
return NULL;
}
static inline int
_braille_register_console(struct console *console, struct console_cmdline *c)
{
return 0;
}
static inline int
_braille_unregister_console(struct console *console)
{
return 0;
}
#endif
#endif
#ifndef _CONSOLE_CMDLINE_H
#define _CONSOLE_CMDLINE_H
struct console_cmdline
{
char name[8]; /* Name of the driver */
int index; /* Minor dev. to use */
char *options; /* Options for the driver */
#ifdef CONFIG_A11Y_BRAILLE_CONSOLE
char *brl_options; /* Options for braille driver */
#endif
};
#endif
This diff is collapsed.
...@@ -851,7 +851,7 @@ void task_numa_fault(int node, int pages, bool migrated) ...@@ -851,7 +851,7 @@ void task_numa_fault(int node, int pages, bool migrated)
{ {
struct task_struct *p = current; struct task_struct *p = current;
if (!sched_feat_numa(NUMA)) if (!numabalancing_enabled)
return; return;
/* FIXME: Allocate task-specific structure for placement policy here */ /* FIXME: Allocate task-specific structure for placement policy here */
...@@ -5786,7 +5786,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) ...@@ -5786,7 +5786,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
entity_tick(cfs_rq, se, queued); entity_tick(cfs_rq, se, queued);
} }
if (sched_feat_numa(NUMA)) if (numabalancing_enabled)
task_tick_numa(rq, curr); task_tick_numa(rq, curr);
update_rq_runnable_avg(rq, 1); update_rq_runnable_avg(rq, 1);
......
...@@ -1620,7 +1620,9 @@ static void __split_huge_page_refcount(struct page *page, ...@@ -1620,7 +1620,9 @@ static void __split_huge_page_refcount(struct page *page,
((1L << PG_referenced) | ((1L << PG_referenced) |
(1L << PG_swapbacked) | (1L << PG_swapbacked) |
(1L << PG_mlocked) | (1L << PG_mlocked) |
(1L << PG_uptodate))); (1L << PG_uptodate) |
(1L << PG_active) |
(1L << PG_unevictable)));
page_tail->flags |= (1L << PG_dirty); page_tail->flags |= (1L << PG_dirty);
/* clear PageTail before overwriting first_page */ /* clear PageTail before overwriting first_page */
......
...@@ -6335,6 +6335,7 @@ static void mem_cgroup_css_offline(struct cgroup *cont) ...@@ -6335,6 +6335,7 @@ static void mem_cgroup_css_offline(struct cgroup *cont)
mem_cgroup_invalidate_reclaim_iterators(memcg); mem_cgroup_invalidate_reclaim_iterators(memcg);
mem_cgroup_reparent_charges(memcg); mem_cgroup_reparent_charges(memcg);
mem_cgroup_destroy_all_caches(memcg); mem_cgroup_destroy_all_caches(memcg);
vmpressure_cleanup(&memcg->vmpressure);
} }
static void mem_cgroup_css_free(struct cgroup *cont) static void mem_cgroup_css_free(struct cgroup *cont)
......
...@@ -732,7 +732,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, ...@@ -732,7 +732,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
if (prev) { if (prev) {
vma = prev; vma = prev;
next = vma->vm_next; next = vma->vm_next;
if (mpol_equal(vma_policy(vma), new_pol))
continue; continue;
/* vma_merge() joined vma && vma->next, case 8 */
goto replace;
} }
if (vma->vm_start != vmstart) { if (vma->vm_start != vmstart) {
err = split_vma(vma->vm_mm, vma, vmstart, 1); err = split_vma(vma->vm_mm, vma, vmstart, 1);
...@@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, ...@@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
if (err) if (err)
goto out; goto out;
} }
replace:
err = vma_replace_policy(vma, new_pol); err = vma_replace_policy(vma, new_pol);
if (err) if (err)
goto out; goto out;
......
...@@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->vm_end); ...@@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->vm_end);
if (next->anon_vma) if (next->anon_vma)
anon_vma_merge(vma, next); anon_vma_merge(vma, next);
mm->map_count--; mm->map_count--;
vma_set_policy(vma, vma_policy(next)); mpol_put(vma_policy(next));
kmem_cache_free(vm_area_cachep, next); kmem_cache_free(vm_area_cachep, next);
/* /*
* In mprotect's case 6 (see comments on vma_merge), * In mprotect's case 6 (see comments on vma_merge),
......
...@@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add); ...@@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add);
*/ */
void lru_cache_add(struct page *page) void lru_cache_add(struct page *page)
{ {
if (PageActive(page)) { VM_BUG_ON(PageActive(page) && PageUnevictable(page));
VM_BUG_ON(PageUnevictable(page));
} else if (PageUnevictable(page)) {
VM_BUG_ON(PageActive(page));
}
VM_BUG_ON(PageLRU(page)); VM_BUG_ON(PageLRU(page));
__lru_cache_add(page); __lru_cache_add(page);
} }
...@@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page) ...@@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page)
spin_lock_irq(&zone->lru_lock); spin_lock_irq(&zone->lru_lock);
lruvec = mem_cgroup_page_lruvec(page, zone); lruvec = mem_cgroup_page_lruvec(page, zone);
ClearPageActive(page);
SetPageUnevictable(page); SetPageUnevictable(page);
SetPageLRU(page); SetPageLRU(page);
add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE);
...@@ -774,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release); ...@@ -774,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release);
void lru_add_page_tail(struct page *page, struct page *page_tail, void lru_add_page_tail(struct page *page, struct page *page_tail,
struct lruvec *lruvec, struct list_head *list) struct lruvec *lruvec, struct list_head *list)
{ {
int uninitialized_var(active);
enum lru_list lru;
const int file = 0; const int file = 0;
VM_BUG_ON(!PageHead(page)); VM_BUG_ON(!PageHead(page));
...@@ -787,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, ...@@ -787,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
if (!list) if (!list)
SetPageLRU(page_tail); SetPageLRU(page_tail);
if (page_evictable(page_tail)) {
if (PageActive(page)) {
SetPageActive(page_tail);
active = 1;
lru = LRU_ACTIVE_ANON;
} else {
active = 0;
lru = LRU_INACTIVE_ANON;
}
} else {
SetPageUnevictable(page_tail);
lru = LRU_UNEVICTABLE;
}
if (likely(PageLRU(page))) if (likely(PageLRU(page)))
list_add_tail(&page_tail->lru, &page->lru); list_add_tail(&page_tail->lru, &page->lru);
else if (list) { else if (list) {
...@@ -816,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, ...@@ -816,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
* Use the standard add function to put page_tail on the list, * Use the standard add function to put page_tail on the list,
* but then correct its position so they all end up in order. * but then correct its position so they all end up in order.
*/ */
add_page_to_lru_list(page_tail, lruvec, lru); add_page_to_lru_list(page_tail, lruvec, page_lru(page_tail));
list_head = page_tail->lru.prev; list_head = page_tail->lru.prev;
list_move_tail(&page_tail->lru, list_head); list_move_tail(&page_tail->lru, list_head);
} }
if (!PageUnevictable(page)) if (!PageUnevictable(page))
update_page_reclaim_stat(lruvec, file, active); update_page_reclaim_stat(lruvec, file, PageActive(page_tail));
} }
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
...@@ -833,7 +813,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, ...@@ -833,7 +813,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
int active = PageActive(page); int active = PageActive(page);
enum lru_list lru = page_lru(page); enum lru_list lru = page_lru(page);
VM_BUG_ON(PageUnevictable(page));
VM_BUG_ON(PageLRU(page)); VM_BUG_ON(PageLRU(page));
SetPageLRU(page); SetPageLRU(page);
......
...@@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work) ...@@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work)
if (!vmpr->scanned) if (!vmpr->scanned)
return; return;
mutex_lock(&vmpr->sr_lock); spin_lock(&vmpr->sr_lock);
scanned = vmpr->scanned; scanned = vmpr->scanned;
reclaimed = vmpr->reclaimed; reclaimed = vmpr->reclaimed;
vmpr->scanned = 0; vmpr->scanned = 0;
vmpr->reclaimed = 0; vmpr->reclaimed = 0;
mutex_unlock(&vmpr->sr_lock); spin_unlock(&vmpr->sr_lock);
do { do {
if (vmpressure_event(vmpr, scanned, reclaimed)) if (vmpressure_event(vmpr, scanned, reclaimed))
...@@ -240,13 +240,13 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, ...@@ -240,13 +240,13 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
if (!scanned) if (!scanned)
return; return;
mutex_lock(&vmpr->sr_lock); spin_lock(&vmpr->sr_lock);
vmpr->scanned += scanned; vmpr->scanned += scanned;
vmpr->reclaimed += reclaimed; vmpr->reclaimed += reclaimed;
scanned = vmpr->scanned; scanned = vmpr->scanned;
mutex_unlock(&vmpr->sr_lock); spin_unlock(&vmpr->sr_lock);
if (scanned < vmpressure_win || work_pending(&vmpr->work)) if (scanned < vmpressure_win)
return; return;
schedule_work(&vmpr->work); schedule_work(&vmpr->work);
} }
...@@ -367,8 +367,24 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, ...@@ -367,8 +367,24 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft,
*/ */
void vmpressure_init(struct vmpressure *vmpr) void vmpressure_init(struct vmpressure *vmpr)
{ {
mutex_init(&vmpr->sr_lock); spin_lock_init(&vmpr->sr_lock);
mutex_init(&vmpr->events_lock); mutex_init(&vmpr->events_lock);
INIT_LIST_HEAD(&vmpr->events); INIT_LIST_HEAD(&vmpr->events);
INIT_WORK(&vmpr->work, vmpressure_work_fn); INIT_WORK(&vmpr->work, vmpressure_work_fn);
} }
/**
* vmpressure_cleanup() - shuts down vmpressure control structure
* @vmpr: Structure to be cleaned up
*
* This function should be called before the structure in which it is
* embedded is cleaned up.
*/
void vmpressure_cleanup(struct vmpressure *vmpr)
{
/*
* Make sure there is no pending work before eventfd infrastructure
* goes away.
*/
flush_work(&vmpr->work);
}
...@@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, ...@@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
if (size <= 0 || gfp & __GFP_HIGHMEM) if (size <= 0 || gfp & __GFP_HIGHMEM)
return -EINVAL; return -EINVAL;
if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED) if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE)
return -ENOSPC; return -ENOSPC;
chunks = size_to_chunks(size); chunks = size_to_chunks(size);
spin_lock(&pool->lock); spin_lock(&pool->lock);
......
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