Skip to content

Commit

Permalink
Merge branch 'akpm' (patches from Andrew)
Browse files Browse the repository at this point in the history
Merge misc fixes from Andrew Morton:
 "A few leftovers"

* emailed patches from Andrew Morton <[email protected]>:
  mm, page_owner: skip unnecessary stack_trace entries
  arm64: stacktrace: avoid listing stacktrace functions in stacktrace
  mm: treewide: remove GFP_TEMPORARY allocation flag
  IB/mlx4: fix sprintf format warning
  fscache: fix fscache_objlist_show format processing
  lib/test_bitmap.c: use ULL suffix for 64-bit constants
  procfs: remove unused variable
  drivers/media/cec/cec-adap.c: fix build with gcc-4.4.4
  idr: remove WARN_ON_ONCE() when trying to replace negative ID
  • Loading branch information
torvalds committed Sep 14, 2017
2 parents 11a19c7 + 5f48f0b commit 7a95bdb
Show file tree
Hide file tree
Showing 44 changed files with 83 additions and 76 deletions.
2 changes: 1 addition & 1 deletion arch/arc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
goto done;
}

str = (char *)__get_free_page(GFP_TEMPORARY);
str = (char *)__get_free_page(GFP_KERNEL);
if (!str)
goto done;

Expand Down
2 changes: 1 addition & 1 deletion arch/arc/kernel/troubleshoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void show_regs(struct pt_regs *regs)
struct callee_regs *cregs;
char *buf;

buf = (char *)__get_free_page(GFP_TEMPORARY);
buf = (char *)__get_free_page(GFP_KERNEL);
if (!buf)
return;

Expand Down
18 changes: 13 additions & 5 deletions arch/arm64/kernel/stacktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}

void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
static noinline void __save_stack_trace(struct task_struct *tsk,
struct stack_trace *trace, unsigned int nosched)
{
struct stack_trace_data data;
struct stackframe frame;
Expand All @@ -150,15 +151,16 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)

data.trace = trace;
data.skip = trace->skip;
data.no_sched_functions = nosched;

if (tsk != current) {
data.no_sched_functions = 1;
frame.fp = thread_saved_fp(tsk);
frame.pc = thread_saved_pc(tsk);
} else {
data.no_sched_functions = 0;
/* We don't want this function nor the caller */
data.skip += 2;
frame.fp = (unsigned long)__builtin_frame_address(0);
frame.pc = (unsigned long)save_stack_trace_tsk;
frame.pc = (unsigned long)__save_stack_trace;
}
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = tsk->curr_ret_stack;
Expand All @@ -172,9 +174,15 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
}
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);

void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
__save_stack_trace(tsk, trace, 1);
}

void save_stack_trace(struct stack_trace *trace)
{
save_stack_trace_tsk(current, trace);
__save_stack_trace(current, trace, 0);
}

EXPORT_SYMBOL_GPL(save_stack_trace);
#endif
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/rtas.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ int rtas_online_cpus_mask(cpumask_var_t cpus)
if (ret) {
cpumask_var_t tmp_mask;

if (!alloc_cpumask_var(&tmp_mask, GFP_TEMPORARY))
if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL))
return ret;

/* Use tmp_mask to preserve cpus mask from first failure */
Expand Down Expand Up @@ -962,7 +962,7 @@ int rtas_ibm_suspend_me(u64 handle)
return -EIO;
}

if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL))
return -ENOMEM;

atomic_set(&data.working, 0);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/pseries/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static ssize_t store_hibernate(struct device *dev,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL))
return -ENOMEM;

stream_id = simple_strtoul(buf, NULL, 16);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_blend.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
crtc->base.id, crtc->name);

states = kmalloc_array(total_planes, sizeof(*states), GFP_TEMPORARY);
states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
if (!states)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_dp_dual_mode_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
void *data;
int ret;

data = kmalloc(msg.len, GFP_TEMPORARY);
data = kmalloc(msg.len, GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_scdc_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
void *data;
int err;

data = kmalloc(1 + size, GFP_TEMPORARY);
data = kmalloc(1 + size, GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev,
struct etnaviv_gem_submit *submit;
size_t sz = size_vstruct(nr, sizeof(submit->bos[0]), sizeof(*submit));

submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
if (submit) {
submit->dev = dev;
submit->gpu = gpu;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,7 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,

if (n_pages > ARRAY_SIZE(stack_pages)) {
/* Too big for stack -- allocate temporary array instead */
pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_TEMPORARY);
pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL);
if (!pages)
return NULL;
}
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static int eb_create(struct i915_execbuffer *eb)
* as possible to perform the allocation and warn
* if it fails.
*/
flags = GFP_TEMPORARY;
flags = GFP_KERNEL;
if (size > 1)
flags |= __GFP_NORETRY | __GFP_NOWARN;

Expand Down Expand Up @@ -1515,7 +1515,7 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb)
urelocs = u64_to_user_ptr(eb->exec[i].relocs_ptr);
size = nreloc * sizeof(*relocs);

relocs = kvmalloc_array(size, 1, GFP_TEMPORARY);
relocs = kvmalloc_array(size, 1, GFP_KERNEL);
if (!relocs) {
kvfree(relocs);
err = -ENOMEM;
Expand Down Expand Up @@ -2077,7 +2077,7 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
return ERR_PTR(-EFAULT);

fences = kvmalloc_array(args->num_cliprects, sizeof(*fences),
__GFP_NOWARN | GFP_TEMPORARY);
__GFP_NOWARN | GFP_KERNEL);
if (!fences)
return ERR_PTR(-ENOMEM);

Expand Down Expand Up @@ -2463,9 +2463,9 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,

/* Copy in the exec list from userland */
exec_list = kvmalloc_array(args->buffer_count, sizeof(*exec_list),
__GFP_NOWARN | GFP_TEMPORARY);
__GFP_NOWARN | GFP_KERNEL);
exec2_list = kvmalloc_array(args->buffer_count + 1, sz,
__GFP_NOWARN | GFP_TEMPORARY);
__GFP_NOWARN | GFP_KERNEL);
if (exec_list == NULL || exec2_list == NULL) {
DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
args->buffer_count);
Expand Down Expand Up @@ -2543,7 +2543,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,

/* Allocate an extra slot for use by the command parser */
exec2_list = kvmalloc_array(args->buffer_count + 1, sz,
__GFP_NOWARN | GFP_TEMPORARY);
__GFP_NOWARN | GFP_KERNEL);
if (exec2_list == NULL) {
DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
args->buffer_count);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_gem_gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,7 @@ intel_rotate_pages(struct intel_rotation_info *rot_info,
/* Allocate a temporary list of source pages for random access. */
page_addr_list = kvmalloc_array(n_pages,
sizeof(dma_addr_t),
GFP_TEMPORARY);
GFP_KERNEL);
if (!page_addr_list)
return ERR_PTR(ret);

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/i915_gem_userptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
ret = -ENOMEM;
pinned = 0;

pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_TEMPORARY);
pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
if (pvec != NULL) {
struct mm_struct *mm = obj->userptr.mm->mm;
unsigned int flags = 0;
Expand Down Expand Up @@ -643,7 +643,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)

if (mm == current->mm) {
pvec = kvmalloc_array(num_pages, sizeof(struct page *),
GFP_TEMPORARY |
GFP_KERNEL |
__GFP_NORETRY |
__GFP_NOWARN);
if (pvec) /* defer to worker if malloc fails */
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_gpu_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,16 @@ int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
*/
ebuf->size = count + 1 > PAGE_SIZE ? count + 1 : PAGE_SIZE;
ebuf->buf = kmalloc(ebuf->size,
GFP_TEMPORARY | __GFP_NORETRY | __GFP_NOWARN);
GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);

if (ebuf->buf == NULL) {
ebuf->size = PAGE_SIZE;
ebuf->buf = kmalloc(ebuf->size, GFP_TEMPORARY);
ebuf->buf = kmalloc(ebuf->size, GFP_KERNEL);
}

if (ebuf->buf == NULL) {
ebuf->size = 128;
ebuf->buf = kmalloc(ebuf->size, GFP_TEMPORARY);
ebuf->buf = kmalloc(ebuf->size, GFP_KERNEL);
}

if (ebuf->buf == NULL)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/selftests/i915_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ unsigned int *i915_random_order(unsigned int count, struct rnd_state *state)
{
unsigned int *order, i;

order = kmalloc_array(count, sizeof(*order), GFP_TEMPORARY);
order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
if (!order)
return order;

Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ static int igt_random_insert_remove(void *arg)

mock_engine_reset(engine);

waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
if (!waiters)
goto out_engines;

bitmap = kcalloc(DIV_ROUND_UP(count, BITS_PER_LONG), sizeof(*bitmap),
GFP_TEMPORARY);
GFP_KERNEL);
if (!bitmap)
goto out_waiters;

Expand Down Expand Up @@ -187,12 +187,12 @@ static int igt_insert_complete(void *arg)

mock_engine_reset(engine);

waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
if (!waiters)
goto out_engines;

bitmap = kcalloc(DIV_ROUND_UP(count, BITS_PER_LONG), sizeof(*bitmap),
GFP_TEMPORARY);
GFP_KERNEL);
if (!bitmap)
goto out_waiters;

Expand Down Expand Up @@ -368,7 +368,7 @@ static int igt_wakeup(void *arg)

mock_engine_reset(engine);

waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
if (!waiters)
goto out_engines;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/selftests/intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_pri
return 0;

valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid),
GFP_TEMPORARY);
GFP_KERNEL);
if (!valid)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/lib/drm_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ unsigned int *drm_random_order(unsigned int count, struct rnd_state *state)
{
unsigned int *order, i;

order = kmalloc_array(count, sizeof(*order), GFP_TEMPORARY);
order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
if (!order)
return order;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/msm/msm_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
if (sz > SIZE_MAX)
return NULL;

submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
if (!submit)
return NULL;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/selftests/test-drm_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ static int igt_topdown(void *ignored)
goto err;

bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
GFP_TEMPORARY);
GFP_KERNEL);
if (!bitmap)
goto err_nodes;

Expand Down Expand Up @@ -1741,7 +1741,7 @@ static int igt_bottomup(void *ignored)
goto err;

bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
GFP_TEMPORARY);
GFP_KERNEL);
if (!bitmap)
goto err_nodes;

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/mlx4/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void del_sysfs_port_mcg_attr(struct mlx4_ib_dev *device, int port_num,
static int add_port_entries(struct mlx4_ib_dev *device, int port_num)
{
int i;
char buff[10];
char buff[11];
struct mlx4_ib_iov_port *port = NULL;
int ret = 0 ;
struct ib_port_attr attr;
Expand Down
5 changes: 4 additions & 1 deletion drivers/media/cec/cec-adap.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg)
{
static const struct cec_event ev_lost_msgs = {
.event = CEC_EVENT_LOST_MSGS,
.lost_msgs.lost_msgs = 1,
.flags = 0,
{
.lost_msgs = { 1 },
},
};
struct cec_msg_entry *entry;

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/cxl/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
}

/* use bounce buffer for copy */
tbuf = (void *)__get_free_page(GFP_TEMPORARY);
tbuf = (void *)__get_free_page(GFP_KERNEL);
if (!tbuf)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/xen/gntalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,
goto out;
}

gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY);
gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_KERNEL);
if (!gref_ids) {
rc = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion fs/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static int cn_print_exe_file(struct core_name *cn)
if (!exe_file)
return cn_esc_printf(cn, "%s (path unknown)", current->comm);

pathbuf = kmalloc(PATH_MAX, GFP_TEMPORARY);
pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
if (!pathbuf) {
ret = -ENOMEM;
goto put_exe_file;
Expand Down
4 changes: 2 additions & 2 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1763,9 +1763,9 @@ static int do_execveat_common(int fd, struct filename *filename,
bprm->filename = filename->name;
} else {
if (filename->name[0] == '\0')
pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d", fd);
pathbuf = kasprintf(GFP_KERNEL, "/dev/fd/%d", fd);
else
pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d/%s",
pathbuf = kasprintf(GFP_KERNEL, "/dev/fd/%d/%s",
fd, filename->name);
if (!pathbuf) {
retval = -ENOMEM;
Expand Down
3 changes: 2 additions & 1 deletion fs/fscache/object-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
type = "DT";
break;
default:
sprintf(_type, "%02u", cookie->def->type);
snprintf(_type, sizeof(_type), "%02u",
cookie->def->type);
type = _type;
break;
}
Expand Down
Loading

0 comments on commit 7a95bdb

Please sign in to comment.