Commit 8d276377 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (fixes from Andrew)

Merge patches from Andrew Morton:
  "13 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm: memcg: do not allow task about to OOM kill to bypass the limit
  mm: memcg: fix race condition between memcg teardown and swapin
  thp: move preallocated PTE page table on move_huge_pmd()
  mfd/rtc: s5m: fix register updating by adding regmap for RTC
  rtc: s5m: enable IRQ wake during suspend
  rtc: s5m: limit endless loop waiting for register update
  rtc: s5m: fix unsuccesful IRQ request during probe
  drivers/rtc/rtc-s5m.c: fix info->rtc assignment
  include/linux/kernel.h: make might_fault() a nop for !MMU
  drivers/rtc/rtc-at91rm9200.c: correct alarm over day/month wrap
  procfs: also fix proc_reg_get_unmapped_area() for !MMU case
  mm: memcg: do not declare OOM from __GFP_NOFAIL allocations
  include/linux/hugetlb.h: make isolate_huge_page() an inline
parents 54fb723c 1f14c1ac
...@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = { ...@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = {
int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
{ {
return regmap_read(sec_pmic->regmap, reg, dest); return regmap_read(sec_pmic->regmap_pmic, reg, dest);
} }
EXPORT_SYMBOL_GPL(sec_reg_read); EXPORT_SYMBOL_GPL(sec_reg_read);
int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{ {
return regmap_bulk_read(sec_pmic->regmap, reg, buf, count); return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count);
} }
EXPORT_SYMBOL_GPL(sec_bulk_read); EXPORT_SYMBOL_GPL(sec_bulk_read);
int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
{ {
return regmap_write(sec_pmic->regmap, reg, value); return regmap_write(sec_pmic->regmap_pmic, reg, value);
} }
EXPORT_SYMBOL_GPL(sec_reg_write); EXPORT_SYMBOL_GPL(sec_reg_write);
int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{ {
return regmap_raw_write(sec_pmic->regmap, reg, buf, count); return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count);
} }
EXPORT_SYMBOL_GPL(sec_bulk_write); EXPORT_SYMBOL_GPL(sec_bulk_write);
int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
{ {
return regmap_update_bits(sec_pmic->regmap, reg, mask, val); return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val);
} }
EXPORT_SYMBOL_GPL(sec_reg_update); EXPORT_SYMBOL_GPL(sec_reg_update);
...@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = { ...@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = {
.cache_type = REGCACHE_FLAT, .cache_type = REGCACHE_FLAT,
}; };
static const struct regmap_config sec_rtc_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
#ifdef CONFIG_OF #ifdef CONFIG_OF
/* /*
* Only the common platform data elements for s5m8767 are parsed here from the * Only the common platform data elements for s5m8767 are parsed here from the
...@@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, ...@@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
break; break;
} }
sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap);
if (IS_ERR(sec_pmic->regmap)) { if (IS_ERR(sec_pmic->regmap_pmic)) {
ret = PTR_ERR(sec_pmic->regmap); ret = PTR_ERR(sec_pmic->regmap_pmic);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret); ret);
return ret; return ret;
...@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c, ...@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR);
i2c_set_clientdata(sec_pmic->rtc, sec_pmic); i2c_set_clientdata(sec_pmic->rtc, sec_pmic);
sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc,
&sec_rtc_regmap_config);
if (IS_ERR(sec_pmic->regmap_rtc)) {
ret = PTR_ERR(sec_pmic->regmap_rtc);
dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
ret);
return ret;
}
if (pdata && pdata->cfg_pmic_irq) if (pdata && pdata->cfg_pmic_irq)
pdata->cfg_pmic_irq(); pdata->cfg_pmic_irq();
......
...@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) ...@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
switch (type) { switch (type) {
case S5M8763X: case S5M8763X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s5m8763_irq_chip, sec_pmic->irq_base, &s5m8763_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
break; break;
case S5M8767X: case S5M8767X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s5m8767_irq_chip, sec_pmic->irq_base, &s5m8767_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
break; break;
case S2MPS11X: case S2MPS11X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s2mps11_irq_chip, sec_pmic->irq_base, &s2mps11_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
......
...@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
config.dev = s5m8767->dev; config.dev = s5m8767->dev;
config.init_data = pdata->regulators[i].initdata; config.init_data = pdata->regulators[i].initdata;
config.driver_data = s5m8767; config.driver_data = s5m8767;
config.regmap = iodev->regmap; config.regmap = iodev->regmap_pmic;
config.of_node = pdata->regulators[i].reg_node; config.of_node = pdata->regulators[i].reg_node;
rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id], rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
......
...@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
at91_alarm_year = tm.tm_year; at91_alarm_year = tm.tm_year;
tm.tm_mon = alrm->time.tm_mon;
tm.tm_mday = alrm->time.tm_mday;
tm.tm_hour = alrm->time.tm_hour; tm.tm_hour = alrm->time.tm_hour;
tm.tm_min = alrm->time.tm_min; tm.tm_min = alrm->time.tm_min;
tm.tm_sec = alrm->time.tm_sec; tm.tm_sec = alrm->time.tm_sec;
......
This diff is collapsed.
...@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, ...@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr,
{ {
struct proc_dir_entry *pde = PDE(file_inode(file)); struct proc_dir_entry *pde = PDE(file_inode(file));
unsigned long rv = -EIO; unsigned long rv = -EIO;
unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
unsigned long, unsigned long) = NULL;
if (use_pde(pde)) { if (use_pde(pde)) {
typeof(proc_reg_get_unmapped_area) *get_area;
get_area = pde->proc_fops->get_unmapped_area;
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
if (!get_area)
get_area = current->mm->get_unmapped_area; get_area = current->mm->get_unmapped_area;
#endif #endif
if (pde->proc_fops->get_unmapped_area)
get_area = pde->proc_fops->get_unmapped_area;
if (get_area) if (get_area)
rv = get_area(file, orig_addr, len, pgoff, flags); rv = get_area(file, orig_addr, len, pgoff, flags);
else
rv = orig_addr;
unuse_pde(pde); unuse_pde(pde);
} }
return rv; return rv;
......
...@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page) ...@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
return 0; return 0;
} }
#define isolate_huge_page(p, l) false static inline bool isolate_huge_page(struct page *page, struct list_head *list)
{
return false;
}
#define putback_active_hugepage(p) do {} while (0) #define putback_active_hugepage(p) do {} while (0)
#define is_hugepage_active(x) false #define is_hugepage_active(x) false
......
...@@ -193,7 +193,8 @@ extern int _cond_resched(void); ...@@ -193,7 +193,8 @@ extern int _cond_resched(void);
(__x < 0) ? -__x : __x; \ (__x < 0) ? -__x : __x; \
}) })
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) #if defined(CONFIG_MMU) && \
(defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP))
void might_fault(void); void might_fault(void);
#else #else
static inline void might_fault(void) { } static inline void might_fault(void) { }
......
...@@ -39,7 +39,8 @@ enum sec_device_type { ...@@ -39,7 +39,8 @@ enum sec_device_type {
struct sec_pmic_dev { struct sec_pmic_dev {
struct device *dev; struct device *dev;
struct sec_platform_data *pdata; struct sec_platform_data *pdata;
struct regmap *regmap; struct regmap *regmap_pmic;
struct regmap *regmap_rtc;
struct i2c_client *i2c; struct i2c_client *i2c;
struct i2c_client *rtc; struct i2c_client *rtc;
......
...@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, ...@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); pmd = pmdp_get_and_clear(mm, old_addr, old_pmd);
VM_BUG_ON(!pmd_none(*new_pmd)); VM_BUG_ON(!pmd_none(*new_pmd));
set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd));
if (new_ptl != old_ptl) if (new_ptl != old_ptl) {
pgtable_t pgtable;
/*
* Move preallocated PTE page table if new_pmd is on
* different PMD page table.
*/
pgtable = pgtable_trans_huge_withdraw(mm, old_pmd);
pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
spin_unlock(new_ptl); spin_unlock(new_ptl);
}
spin_unlock(old_ptl); spin_unlock(old_ptl);
} }
out: out:
......
...@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, ...@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
goto bypass; goto bypass;
if (unlikely(task_in_memcg_oom(current))) if (unlikely(task_in_memcg_oom(current)))
goto bypass; goto nomem;
if (gfp_mask & __GFP_NOFAIL)
oom = false;
/* /*
* We always charge the cgroup the mm_struct belongs to. * We always charge the cgroup the mm_struct belongs to.
...@@ -6352,6 +6355,42 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) ...@@ -6352,6 +6355,42 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
static void mem_cgroup_css_free(struct cgroup_subsys_state *css) static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
{ {
struct mem_cgroup *memcg = mem_cgroup_from_css(css); struct mem_cgroup *memcg = mem_cgroup_from_css(css);
/*
* XXX: css_offline() would be where we should reparent all
* memory to prepare the cgroup for destruction. However,
* memcg does not do css_tryget() and res_counter charging
* under the same RCU lock region, which means that charging
* could race with offlining. Offlining only happens to
* cgroups with no tasks in them but charges can show up
* without any tasks from the swapin path when the target
* memcg is looked up from the swapout record and not from the
* current task as it usually is. A race like this can leak
* charges and put pages with stale cgroup pointers into
* circulation:
*
* #0 #1
* lookup_swap_cgroup_id()
* rcu_read_lock()
* mem_cgroup_lookup()
* css_tryget()
* rcu_read_unlock()
* disable css_tryget()
* call_rcu()
* offline_css()
* reparent_charges()
* res_counter_charge()
* css_put()
* css_free()
* pc->mem_cgroup = dead memcg
* add page to lru
*
* The bulk of the charges are still moved in offline_css() to
* avoid pinning a lot of pages in case a long-term reference
* like a swapout record is deferring the css_free() to long
* after offlining. But this makes sure we catch any charges
* made after offlining:
*/
mem_cgroup_reparent_charges(memcg);
memcg_destroy_kmem(memcg); memcg_destroy_kmem(memcg);
__mem_cgroup_free(memcg); __mem_cgroup_free(memcg);
......
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