mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
Merge branch 'linaro-fixes/android-3.10' into 'linaro-android-3.10-lsk'
This commit is contained in:
@@ -24,6 +24,7 @@ CONFIG_INET6_ESP=y
|
||||
CONFIG_INET6_IPCOMP=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_INET_ESP=y
|
||||
CONFIG_INET_XFRM_MODE_TUNNEL=y
|
||||
CONFIG_IP6_NF_FILTER=y
|
||||
CONFIG_IP6_NF_IPTABLES=y
|
||||
CONFIG_IP6_NF_MANGLE=y
|
||||
|
||||
@@ -268,6 +268,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self,
|
||||
case CPU_PM_ENTER:
|
||||
if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE))
|
||||
fpsimd_save_state(¤t->thread.fpsimd_state);
|
||||
this_cpu_write(fpsimd_last_state, NULL);
|
||||
break;
|
||||
case CPU_PM_EXIT:
|
||||
if (current->mm)
|
||||
|
||||
@@ -117,7 +117,7 @@ struct cpufreq_interactive_tunables {
|
||||
};
|
||||
|
||||
/* For cases where we have single governor instance for system */
|
||||
struct cpufreq_interactive_tunables *common_tunables;
|
||||
static struct cpufreq_interactive_tunables *common_tunables;
|
||||
|
||||
static struct attribute_group *get_sysfs_attr(void);
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/cred.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
@@ -30,6 +32,16 @@ static void seq_set_overflow(struct seq_file *m)
|
||||
m->count = m->size;
|
||||
}
|
||||
|
||||
static void *seq_buf_alloc(unsigned long size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
|
||||
if (!buf && size > PAGE_SIZE)
|
||||
buf = vmalloc(size);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* seq_open - initialize sequential file
|
||||
* @file: file we initialize
|
||||
@@ -96,7 +108,7 @@ static int traverse(struct seq_file *m, loff_t offset)
|
||||
return 0;
|
||||
}
|
||||
if (!m->buf) {
|
||||
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
|
||||
m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
|
||||
if (!m->buf)
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -135,8 +147,8 @@ static int traverse(struct seq_file *m, loff_t offset)
|
||||
|
||||
Eoverflow:
|
||||
m->op->stop(m, p);
|
||||
kfree(m->buf);
|
||||
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
|
||||
kvfree(m->buf);
|
||||
m->buf = seq_buf_alloc(m->size <<= 1);
|
||||
return !m->buf ? -ENOMEM : -EAGAIN;
|
||||
}
|
||||
|
||||
@@ -191,7 +203,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
|
||||
|
||||
/* grab buffer if we didn't have one */
|
||||
if (!m->buf) {
|
||||
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
|
||||
m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
|
||||
if (!m->buf)
|
||||
goto Enomem;
|
||||
}
|
||||
@@ -231,8 +243,8 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
|
||||
if (m->count < m->size)
|
||||
goto Fill;
|
||||
m->op->stop(m, p);
|
||||
kfree(m->buf);
|
||||
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
|
||||
kvfree(m->buf);
|
||||
m->buf = seq_buf_alloc(m->size <<= 1);
|
||||
if (!m->buf)
|
||||
goto Enomem;
|
||||
m->count = 0;
|
||||
@@ -347,7 +359,7 @@ EXPORT_SYMBOL(seq_lseek);
|
||||
int seq_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct seq_file *m = file->private_data;
|
||||
kfree(m->buf);
|
||||
kvfree(m->buf);
|
||||
kfree(m);
|
||||
return 0;
|
||||
}
|
||||
@@ -602,13 +614,13 @@ EXPORT_SYMBOL(single_open);
|
||||
int single_open_size(struct file *file, int (*show)(struct seq_file *, void *),
|
||||
void *data, size_t size)
|
||||
{
|
||||
char *buf = kmalloc(size, GFP_KERNEL);
|
||||
char *buf = seq_buf_alloc(size);
|
||||
int ret;
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
ret = single_open(file, show, data);
|
||||
if (ret) {
|
||||
kfree(buf);
|
||||
kvfree(buf);
|
||||
return ret;
|
||||
}
|
||||
((struct seq_file *)file->private_data)->buf = buf;
|
||||
|
||||
@@ -324,6 +324,8 @@ static inline int is_vmalloc_or_module_addr(const void *x)
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void kvfree(const void *addr);
|
||||
|
||||
static inline void compound_lock(struct page *page)
|
||||
{
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
|
||||
10
mm/util.c
10
mm/util.c
@@ -7,6 +7,7 @@
|
||||
#include <linux/security.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/swapops.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include "internal.h"
|
||||
@@ -384,6 +385,15 @@ unsigned long vm_mmap(struct file *file, unsigned long addr,
|
||||
}
|
||||
EXPORT_SYMBOL(vm_mmap);
|
||||
|
||||
void kvfree(const void *addr)
|
||||
{
|
||||
if (is_vmalloc_addr(addr))
|
||||
vfree(addr);
|
||||
else
|
||||
kfree(addr);
|
||||
}
|
||||
EXPORT_SYMBOL(kvfree);
|
||||
|
||||
struct address_space *page_mapping(struct page *page)
|
||||
{
|
||||
struct address_space *mapping = page->mapping;
|
||||
|
||||
@@ -65,7 +65,6 @@ extern int apparmor_initialized __initdata;
|
||||
char *aa_split_fqname(char *args, char **ns_name);
|
||||
void aa_info_message(const char *str);
|
||||
void *kvmalloc(size_t size);
|
||||
void kvfree(void *buffer);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,35 +103,3 @@ void *kvmalloc(size_t size)
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* do_vfree - workqueue routine for freeing vmalloced memory
|
||||
* @work: data to be freed
|
||||
*
|
||||
* The work_struct is overlaid to the data being freed, as at the point
|
||||
* the work is scheduled the data is no longer valid, be its freeing
|
||||
* needs to be delayed until safe.
|
||||
*/
|
||||
static void do_vfree(struct work_struct *work)
|
||||
{
|
||||
vfree(work);
|
||||
}
|
||||
|
||||
/**
|
||||
* kvfree - free an allocation do by kvmalloc
|
||||
* @buffer: buffer to free (MAYBE_NULL)
|
||||
*
|
||||
* Free a buffer allocated by kvmalloc
|
||||
*/
|
||||
void kvfree(void *buffer)
|
||||
{
|
||||
if (is_vmalloc_addr(buffer)) {
|
||||
/* Data is no longer valid so just use the allocated space
|
||||
* as the work_struct
|
||||
*/
|
||||
struct work_struct *work = (struct work_struct *) buffer;
|
||||
INIT_WORK(work, do_vfree);
|
||||
schedule_work(work);
|
||||
} else
|
||||
kfree(buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user