Merge branch 'akpm' (patches from Andrew)
Merge some more updates from Andrew Morton: - various hotfixes and minor things - hch's use_mm/unuse_mm clearnups Subsystems affected by this patch series: mm/hugetlb, scripts, kcov, lib, nilfs, checkpatch, lib, mm/debug, ocfs2, lib, misc. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: kernel: set USER_DS in kthread_use_mm kernel: better document the use_mm/unuse_mm API contract kernel: move use_mm/unuse_mm to kthread.c kernel: move use_mm/unuse_mm to kthread.c stacktrace: cleanup inconsistent variable type lib: test get_count_order/long in test_bitops.c mm: add comments on pglist_data zones ocfs2: fix spelling mistake and grammar mm/debug_vm_pgtable: fix kernel crash by checking for THP support lib: fix bitmap_parse() on 64-bit big endian archs checkpatch: correct check for kernel parameters doc nilfs2: fix null pointer dereference at nilfs_segctor_do_construct() lib/lz4/lz4_decompress.c: document deliberate use of `&' kcov: check kcov_softirq in kcov_remote_stop() scripts/spelling: add a few more typos khugepaged: selftests: fix timeout condition in wait_for_scan()
This commit is contained in:
@@ -127,7 +127,7 @@ static void update_csb(struct vas_window *window,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
use_mm(window->mm);
|
kthread_use_mm(window->mm);
|
||||||
rc = copy_to_user(csb_addr, &csb, sizeof(csb));
|
rc = copy_to_user(csb_addr, &csb, sizeof(csb));
|
||||||
/*
|
/*
|
||||||
* User space polls on csb.flags (first byte). So add barrier
|
* User space polls on csb.flags (first byte). So add barrier
|
||||||
@@ -139,7 +139,7 @@ static void update_csb(struct vas_window *window,
|
|||||||
smp_mb();
|
smp_mb();
|
||||||
rc = copy_to_user(csb_addr, &csb, sizeof(u8));
|
rc = copy_to_user(csb_addr, &csb, sizeof(u8));
|
||||||
}
|
}
|
||||||
unuse_mm(window->mm);
|
kthread_unuse_mm(window->mm);
|
||||||
put_task_struct(tsk);
|
put_task_struct(tsk);
|
||||||
|
|
||||||
/* Success */
|
/* Success */
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
#include <linux/kthread.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <kgd_kfd_interface.h>
|
#include <kgd_kfd_interface.h>
|
||||||
#include <drm/ttm/ttm_execbuf_util.h>
|
#include <drm/ttm/ttm_execbuf_util.h>
|
||||||
@@ -196,9 +197,9 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s
|
|||||||
if ((mmptr) == current->mm) { \
|
if ((mmptr) == current->mm) { \
|
||||||
valid = !get_user((dst), (wptr)); \
|
valid = !get_user((dst), (wptr)); \
|
||||||
} else if (current->mm == NULL) { \
|
} else if (current->mm == NULL) { \
|
||||||
use_mm(mmptr); \
|
kthread_use_mm(mmptr); \
|
||||||
valid = !get_user((dst), (wptr)); \
|
valid = !get_user((dst), (wptr)); \
|
||||||
unuse_mm(mmptr); \
|
kthread_unuse_mm(mmptr); \
|
||||||
} \
|
} \
|
||||||
pagefault_enable(); \
|
pagefault_enable(); \
|
||||||
} \
|
} \
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/fdtable.h>
|
#include <linux/fdtable.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
#include "gc/gc_10_1_0_offset.h"
|
#include "gc/gc_10_1_0_offset.h"
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
#include "cikd.h"
|
#include "cikd.h"
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
#include "gfx_v8_0.h"
|
#include "gfx_v8_0.h"
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
#include "gc/gc_9_0_offset.h"
|
#include "gc/gc_9_0_offset.h"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mmu_context.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/sched/mm.h>
|
#include <linux/sched/mm.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include <linux/usb/functionfs.h>
|
#include <linux/usb/functionfs.h>
|
||||||
|
|
||||||
#include <linux/aio.h>
|
#include <linux/aio.h>
|
||||||
#include <linux/mmu_context.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/eventfd.h>
|
#include <linux/eventfd.h>
|
||||||
|
|
||||||
@@ -824,13 +824,9 @@ static void ffs_user_copy_worker(struct work_struct *work)
|
|||||||
bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;
|
bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;
|
||||||
|
|
||||||
if (io_data->read && ret > 0) {
|
if (io_data->read && ret > 0) {
|
||||||
mm_segment_t oldfs = get_fs();
|
kthread_use_mm(io_data->mm);
|
||||||
|
|
||||||
set_fs(USER_DS);
|
|
||||||
use_mm(io_data->mm);
|
|
||||||
ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data);
|
ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data);
|
||||||
unuse_mm(io_data->mm);
|
kthread_unuse_mm(io_data->mm);
|
||||||
set_fs(oldfs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io_data->kiocb->ki_complete(io_data->kiocb, ret, ret);
|
io_data->kiocb->ki_complete(io_data->kiocb, ret, ret);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/mmu_context.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/aio.h>
|
#include <linux/aio.h>
|
||||||
#include <linux/uio.h>
|
#include <linux/uio.h>
|
||||||
#include <linux/refcount.h>
|
#include <linux/refcount.h>
|
||||||
@@ -462,9 +462,9 @@ static void ep_user_copy_worker(struct work_struct *work)
|
|||||||
struct kiocb *iocb = priv->iocb;
|
struct kiocb *iocb = priv->iocb;
|
||||||
size_t ret;
|
size_t ret;
|
||||||
|
|
||||||
use_mm(mm);
|
kthread_use_mm(mm);
|
||||||
ret = copy_to_iter(priv->buf, priv->actual, &priv->to);
|
ret = copy_to_iter(priv->buf, priv->actual, &priv->to);
|
||||||
unuse_mm(mm);
|
kthread_unuse_mm(mm);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <linux/iommu.h>
|
#include <linux/iommu.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mmu_context.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/rbtree.h>
|
#include <linux/rbtree.h>
|
||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
#include <linux/sched/mm.h>
|
#include <linux/sched/mm.h>
|
||||||
@@ -2817,7 +2817,7 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
if (kthread)
|
if (kthread)
|
||||||
use_mm(mm);
|
kthread_use_mm(mm);
|
||||||
else if (current->mm != mm)
|
else if (current->mm != mm)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@@ -2844,7 +2844,7 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,
|
|||||||
*copied = copy_from_user(data, (void __user *)vaddr,
|
*copied = copy_from_user(data, (void __user *)vaddr,
|
||||||
count) ? 0 : count;
|
count) ? 0 : count;
|
||||||
if (kthread)
|
if (kthread)
|
||||||
unuse_mm(mm);
|
kthread_unuse_mm(mm);
|
||||||
out:
|
out:
|
||||||
mmput(mm);
|
mmput(mm);
|
||||||
return *copied ? 0 : -EFAULT;
|
return *copied ? 0 : -EFAULT;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include <linux/vhost.h>
|
#include <linux/vhost.h>
|
||||||
#include <linux/uio.h>
|
#include <linux/uio.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/miscdevice.h>
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
@@ -335,10 +334,8 @@ static int vhost_worker(void *data)
|
|||||||
struct vhost_dev *dev = data;
|
struct vhost_dev *dev = data;
|
||||||
struct vhost_work *work, *work_next;
|
struct vhost_work *work, *work_next;
|
||||||
struct llist_node *node;
|
struct llist_node *node;
|
||||||
mm_segment_t oldfs = get_fs();
|
|
||||||
|
|
||||||
set_fs(USER_DS);
|
kthread_use_mm(dev->mm);
|
||||||
use_mm(dev->mm);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* mb paired w/ kthread_stop */
|
/* mb paired w/ kthread_stop */
|
||||||
@@ -366,8 +363,7 @@ static int vhost_worker(void *data)
|
|||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unuse_mm(dev->mm);
|
kthread_unuse_mm(dev->mm);
|
||||||
set_fs(oldfs);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
fs/aio.c
1
fs/aio.c
@@ -27,7 +27,6 @@
|
|||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
|
|||||||
15
fs/io-wq.c
15
fs/io-wq.c
@@ -10,7 +10,6 @@
|
|||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/sched/mm.h>
|
#include <linux/sched/mm.h>
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
@@ -170,8 +169,7 @@ static bool __io_worker_unuse(struct io_wqe *wqe, struct io_worker *worker)
|
|||||||
dropped_lock = true;
|
dropped_lock = true;
|
||||||
}
|
}
|
||||||
__set_current_state(TASK_RUNNING);
|
__set_current_state(TASK_RUNNING);
|
||||||
set_fs(KERNEL_DS);
|
kthread_unuse_mm(worker->mm);
|
||||||
unuse_mm(worker->mm);
|
|
||||||
mmput(worker->mm);
|
mmput(worker->mm);
|
||||||
worker->mm = NULL;
|
worker->mm = NULL;
|
||||||
}
|
}
|
||||||
@@ -418,18 +416,15 @@ static struct io_wq_work *io_get_next_work(struct io_wqe *wqe)
|
|||||||
static void io_wq_switch_mm(struct io_worker *worker, struct io_wq_work *work)
|
static void io_wq_switch_mm(struct io_worker *worker, struct io_wq_work *work)
|
||||||
{
|
{
|
||||||
if (worker->mm) {
|
if (worker->mm) {
|
||||||
unuse_mm(worker->mm);
|
kthread_unuse_mm(worker->mm);
|
||||||
mmput(worker->mm);
|
mmput(worker->mm);
|
||||||
worker->mm = NULL;
|
worker->mm = NULL;
|
||||||
}
|
}
|
||||||
if (!work->mm) {
|
if (!work->mm)
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (mmget_not_zero(work->mm)) {
|
if (mmget_not_zero(work->mm)) {
|
||||||
use_mm(work->mm);
|
kthread_use_mm(work->mm);
|
||||||
if (!worker->mm)
|
|
||||||
set_fs(USER_DS);
|
|
||||||
worker->mm = work->mm;
|
worker->mm = work->mm;
|
||||||
/* hang on to this mm */
|
/* hang on to this mm */
|
||||||
work->mm = NULL;
|
work->mm = NULL;
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
#include <linux/fdtable.h>
|
#include <linux/fdtable.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
@@ -5867,7 +5866,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
|
|||||||
if (io_op_defs[req->opcode].needs_mm && !current->mm) {
|
if (io_op_defs[req->opcode].needs_mm && !current->mm) {
|
||||||
if (unlikely(!mmget_not_zero(ctx->sqo_mm)))
|
if (unlikely(!mmget_not_zero(ctx->sqo_mm)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
use_mm(ctx->sqo_mm);
|
kthread_use_mm(ctx->sqo_mm);
|
||||||
}
|
}
|
||||||
|
|
||||||
sqe_flags = READ_ONCE(sqe->flags);
|
sqe_flags = READ_ONCE(sqe->flags);
|
||||||
@@ -5981,7 +5980,7 @@ static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx)
|
|||||||
struct mm_struct *mm = current->mm;
|
struct mm_struct *mm = current->mm;
|
||||||
|
|
||||||
if (mm) {
|
if (mm) {
|
||||||
unuse_mm(mm);
|
kthread_unuse_mm(mm);
|
||||||
mmput(mm);
|
mmput(mm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5990,15 +5989,12 @@ static int io_sq_thread(void *data)
|
|||||||
{
|
{
|
||||||
struct io_ring_ctx *ctx = data;
|
struct io_ring_ctx *ctx = data;
|
||||||
const struct cred *old_cred;
|
const struct cred *old_cred;
|
||||||
mm_segment_t old_fs;
|
|
||||||
DEFINE_WAIT(wait);
|
DEFINE_WAIT(wait);
|
||||||
unsigned long timeout;
|
unsigned long timeout;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
complete(&ctx->sq_thread_comp);
|
complete(&ctx->sq_thread_comp);
|
||||||
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(USER_DS);
|
|
||||||
old_cred = override_creds(ctx->creds);
|
old_cred = override_creds(ctx->creds);
|
||||||
|
|
||||||
timeout = jiffies + ctx->sq_thread_idle;
|
timeout = jiffies + ctx->sq_thread_idle;
|
||||||
@@ -6103,7 +6099,6 @@ static int io_sq_thread(void *data)
|
|||||||
if (current->task_works)
|
if (current->task_works)
|
||||||
task_work_run();
|
task_work_run();
|
||||||
|
|
||||||
set_fs(old_fs);
|
|
||||||
io_sq_thread_drop_mm(ctx);
|
io_sq_thread_drop_mm(ctx);
|
||||||
revert_creds(old_cred);
|
revert_creds(old_cred);
|
||||||
|
|
||||||
|
|||||||
@@ -2780,6 +2780,8 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root)
|
|||||||
if (!nilfs->ns_writer)
|
if (!nilfs->ns_writer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL);
|
||||||
|
|
||||||
err = nilfs_segctor_start_thread(nilfs->ns_writer);
|
err = nilfs_segctor_start_thread(nilfs->ns_writer);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(nilfs->ns_writer);
|
kfree(nilfs->ns_writer);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ static vm_fault_t __ocfs2_page_mkwrite(struct file *file,
|
|||||||
last_index = (size - 1) >> PAGE_SHIFT;
|
last_index = (size - 1) >> PAGE_SHIFT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are cases that lead to the page no longer bebongs to the
|
* There are cases that lead to the page no longer belonging to the
|
||||||
* mapping.
|
* mapping.
|
||||||
* 1) pagecache truncates locally due to memory pressure.
|
* 1) pagecache truncates locally due to memory pressure.
|
||||||
* 2) pagecache truncates when another is taking EX lock against
|
* 2) pagecache truncates when another is taking EX lock against
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
|
||||||
|
struct mm_struct;
|
||||||
|
|
||||||
__printf(4, 5)
|
__printf(4, 5)
|
||||||
struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
|
struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
|
||||||
void *data,
|
void *data,
|
||||||
@@ -199,6 +201,9 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work);
|
|||||||
|
|
||||||
void kthread_destroy_worker(struct kthread_worker *worker);
|
void kthread_destroy_worker(struct kthread_worker *worker);
|
||||||
|
|
||||||
|
void kthread_use_mm(struct mm_struct *mm);
|
||||||
|
void kthread_unuse_mm(struct mm_struct *mm);
|
||||||
|
|
||||||
struct cgroup_subsys_state;
|
struct cgroup_subsys_state;
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_CGROUP
|
#ifdef CONFIG_BLK_CGROUP
|
||||||
|
|||||||
@@ -4,11 +4,6 @@
|
|||||||
|
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
|
|
||||||
struct mm_struct;
|
|
||||||
|
|
||||||
void use_mm(struct mm_struct *mm);
|
|
||||||
void unuse_mm(struct mm_struct *mm);
|
|
||||||
|
|
||||||
/* Architectures that care about IRQ state in switch_mm can override this. */
|
/* Architectures that care about IRQ state in switch_mm can override this. */
|
||||||
#ifndef switch_mm_irqs_off
|
#ifndef switch_mm_irqs_off
|
||||||
# define switch_mm_irqs_off switch_mm
|
# define switch_mm_irqs_off switch_mm
|
||||||
|
|||||||
@@ -660,9 +660,21 @@ struct deferred_split {
|
|||||||
* per-zone basis.
|
* per-zone basis.
|
||||||
*/
|
*/
|
||||||
typedef struct pglist_data {
|
typedef struct pglist_data {
|
||||||
|
/*
|
||||||
|
* node_zones contains just the zones for THIS node. Not all of the
|
||||||
|
* zones may be populated, but it is the full list. It is referenced by
|
||||||
|
* this node's node_zonelists as well as other node's node_zonelists.
|
||||||
|
*/
|
||||||
struct zone node_zones[MAX_NR_ZONES];
|
struct zone node_zones[MAX_NR_ZONES];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* node_zonelists contains references to all zones in all nodes.
|
||||||
|
* Generally the first zones will be references to this node's
|
||||||
|
* node_zones.
|
||||||
|
*/
|
||||||
struct zonelist node_zonelists[MAX_ZONELISTS];
|
struct zonelist node_zonelists[MAX_ZONELISTS];
|
||||||
int nr_zones;
|
|
||||||
|
int nr_zones; /* number of populated zones in this node */
|
||||||
#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */
|
#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */
|
||||||
struct page *node_mem_map;
|
struct page *node_mem_map;
|
||||||
#ifdef CONFIG_PAGE_EXTENSION
|
#ifdef CONFIG_PAGE_EXTENSION
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
|
|||||||
struct stack_trace {
|
struct stack_trace {
|
||||||
unsigned int nr_entries, max_entries;
|
unsigned int nr_entries, max_entries;
|
||||||
unsigned long *entries;
|
unsigned long *entries;
|
||||||
int skip; /* input argument: How many entries to skip */
|
unsigned int skip; /* input argument: How many entries to skip */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void save_stack_trace(struct stack_trace *trace);
|
extern void save_stack_trace(struct stack_trace *trace);
|
||||||
|
|||||||
@@ -427,7 +427,8 @@ void kcov_task_exit(struct task_struct *t)
|
|||||||
* WARN_ON(!kcov->remote && kcov->t != t);
|
* WARN_ON(!kcov->remote && kcov->t != t);
|
||||||
*
|
*
|
||||||
* For KCOV_REMOTE_ENABLE devices, the exiting task is either:
|
* For KCOV_REMOTE_ENABLE devices, the exiting task is either:
|
||||||
* 2. A remote task between kcov_remote_start() and kcov_remote_stop().
|
*
|
||||||
|
* 1. A remote task between kcov_remote_start() and kcov_remote_stop().
|
||||||
* In this case we should print a warning right away, since a task
|
* In this case we should print a warning right away, since a task
|
||||||
* shouldn't be exiting when it's in a kcov coverage collection
|
* shouldn't be exiting when it's in a kcov coverage collection
|
||||||
* section. Here t points to the task that is collecting remote
|
* section. Here t points to the task that is collecting remote
|
||||||
@@ -437,7 +438,7 @@ void kcov_task_exit(struct task_struct *t)
|
|||||||
* WARN_ON(kcov->remote && kcov->t != t);
|
* WARN_ON(kcov->remote && kcov->t != t);
|
||||||
*
|
*
|
||||||
* 2. The task that created kcov exiting without calling KCOV_DISABLE,
|
* 2. The task that created kcov exiting without calling KCOV_DISABLE,
|
||||||
* and then again we can make sure that t->kcov->t == t:
|
* and then again we make sure that t->kcov->t == t:
|
||||||
* WARN_ON(kcov->remote && kcov->t != t);
|
* WARN_ON(kcov->remote && kcov->t != t);
|
||||||
*
|
*
|
||||||
* By combining all three checks into one we get:
|
* By combining all three checks into one we get:
|
||||||
@@ -764,7 +765,7 @@ static const struct file_operations kcov_fops = {
|
|||||||
* Internally, kcov_remote_start() looks up the kcov device associated with the
|
* Internally, kcov_remote_start() looks up the kcov device associated with the
|
||||||
* provided handle, allocates an area for coverage collection, and saves the
|
* provided handle, allocates an area for coverage collection, and saves the
|
||||||
* pointers to kcov and area into the current task_struct to allow coverage to
|
* pointers to kcov and area into the current task_struct to allow coverage to
|
||||||
* be collected via __sanitizer_cov_trace_pc()
|
* be collected via __sanitizer_cov_trace_pc().
|
||||||
* In turns kcov_remote_stop() clears those pointers from task_struct to stop
|
* In turns kcov_remote_stop() clears those pointers from task_struct to stop
|
||||||
* collecting coverage and copies all collected coverage into the kcov area.
|
* collecting coverage and copies all collected coverage into the kcov area.
|
||||||
*/
|
*/
|
||||||
@@ -972,16 +973,25 @@ void kcov_remote_stop(void)
|
|||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
kcov = t->kcov;
|
/*
|
||||||
area = t->kcov_area;
|
* When in softirq, check if the corresponding kcov_remote_start()
|
||||||
size = t->kcov_size;
|
* actually found the remote handle and started collecting coverage.
|
||||||
sequence = t->kcov_sequence;
|
*/
|
||||||
|
if (in_serving_softirq() && !t->kcov_softirq) {
|
||||||
|
local_irq_restore(flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Make sure that kcov_softirq is only set when in softirq. */
|
||||||
if (WARN_ON(!in_serving_softirq() && t->kcov_softirq)) {
|
if (WARN_ON(!in_serving_softirq() && t->kcov_softirq)) {
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kcov = t->kcov;
|
||||||
|
area = t->kcov_area;
|
||||||
|
size = t->kcov_size;
|
||||||
|
sequence = t->kcov_sequence;
|
||||||
|
|
||||||
kcov_stop(t);
|
kcov_stop(t);
|
||||||
if (in_serving_softirq()) {
|
if (in_serving_softirq()) {
|
||||||
t->kcov_softirq = 0;
|
t->kcov_softirq = 0;
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/* Kernel thread helper functions.
|
/* Kernel thread helper functions.
|
||||||
* Copyright (C) 2004 IBM Corporation, Rusty Russell.
|
* Copyright (C) 2004 IBM Corporation, Rusty Russell.
|
||||||
|
* Copyright (C) 2009 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* Creation is done via kthreadd, so that we get a clean environment
|
* Creation is done via kthreadd, so that we get a clean environment
|
||||||
* even if we're invoked from userspace (think modprobe, hotplug cpu,
|
* even if we're invoked from userspace (think modprobe, hotplug cpu,
|
||||||
* etc.).
|
* etc.).
|
||||||
*/
|
*/
|
||||||
#include <uapi/linux/sched/types.h>
|
#include <uapi/linux/sched/types.h>
|
||||||
|
#include <linux/mm.h>
|
||||||
|
#include <linux/mmu_context.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
#include <linux/sched/mm.h>
|
||||||
#include <linux/sched/task.h>
|
#include <linux/sched/task.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/completion.h>
|
#include <linux/completion.h>
|
||||||
@@ -25,6 +29,7 @@
|
|||||||
#include <linux/numa.h>
|
#include <linux/numa.h>
|
||||||
#include <trace/events/sched.h>
|
#include <trace/events/sched.h>
|
||||||
|
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(kthread_create_lock);
|
static DEFINE_SPINLOCK(kthread_create_lock);
|
||||||
static LIST_HEAD(kthread_create_list);
|
static LIST_HEAD(kthread_create_list);
|
||||||
struct task_struct *kthreadd_task;
|
struct task_struct *kthreadd_task;
|
||||||
@@ -48,6 +53,7 @@ struct kthread {
|
|||||||
unsigned int cpu;
|
unsigned int cpu;
|
||||||
int (*threadfn)(void *);
|
int (*threadfn)(void *);
|
||||||
void *data;
|
void *data;
|
||||||
|
mm_segment_t oldfs;
|
||||||
struct completion parked;
|
struct completion parked;
|
||||||
struct completion exited;
|
struct completion exited;
|
||||||
#ifdef CONFIG_BLK_CGROUP
|
#ifdef CONFIG_BLK_CGROUP
|
||||||
@@ -1220,6 +1226,61 @@ void kthread_destroy_worker(struct kthread_worker *worker)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(kthread_destroy_worker);
|
EXPORT_SYMBOL(kthread_destroy_worker);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kthread_use_mm - make the calling kthread operate on an address space
|
||||||
|
* @mm: address space to operate on
|
||||||
|
*/
|
||||||
|
void kthread_use_mm(struct mm_struct *mm)
|
||||||
|
{
|
||||||
|
struct mm_struct *active_mm;
|
||||||
|
struct task_struct *tsk = current;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD));
|
||||||
|
WARN_ON_ONCE(tsk->mm);
|
||||||
|
|
||||||
|
task_lock(tsk);
|
||||||
|
active_mm = tsk->active_mm;
|
||||||
|
if (active_mm != mm) {
|
||||||
|
mmgrab(mm);
|
||||||
|
tsk->active_mm = mm;
|
||||||
|
}
|
||||||
|
tsk->mm = mm;
|
||||||
|
switch_mm(active_mm, mm, tsk);
|
||||||
|
task_unlock(tsk);
|
||||||
|
#ifdef finish_arch_post_lock_switch
|
||||||
|
finish_arch_post_lock_switch();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (active_mm != mm)
|
||||||
|
mmdrop(active_mm);
|
||||||
|
|
||||||
|
to_kthread(tsk)->oldfs = get_fs();
|
||||||
|
set_fs(USER_DS);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(kthread_use_mm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kthread_unuse_mm - reverse the effect of kthread_use_mm()
|
||||||
|
* @mm: address space to operate on
|
||||||
|
*/
|
||||||
|
void kthread_unuse_mm(struct mm_struct *mm)
|
||||||
|
{
|
||||||
|
struct task_struct *tsk = current;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD));
|
||||||
|
WARN_ON_ONCE(!tsk->mm);
|
||||||
|
|
||||||
|
set_fs(to_kthread(tsk)->oldfs);
|
||||||
|
|
||||||
|
task_lock(tsk);
|
||||||
|
sync_mm_rss(mm);
|
||||||
|
tsk->mm = NULL;
|
||||||
|
/* active_mm is still 'mm' */
|
||||||
|
enter_lazy_tlb(mm, tsk);
|
||||||
|
task_unlock(tsk);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(kthread_unuse_mm);
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_CGROUP
|
#ifdef CONFIG_BLK_CGROUP
|
||||||
/**
|
/**
|
||||||
* kthread_associate_blkcg - associate blkcg to current kthread
|
* kthread_associate_blkcg - associate blkcg to current kthread
|
||||||
|
|||||||
@@ -2052,15 +2052,15 @@ config TEST_LKM
|
|||||||
If unsure, say N.
|
If unsure, say N.
|
||||||
|
|
||||||
config TEST_BITOPS
|
config TEST_BITOPS
|
||||||
tristate "Test module for compilation of clear_bit/set_bit operations"
|
tristate "Test module for compilation of bitops operations"
|
||||||
depends on m
|
depends on m
|
||||||
help
|
help
|
||||||
This builds the "test_bitops" module that is much like the
|
This builds the "test_bitops" module that is much like the
|
||||||
TEST_LKM module except that it does a basic exercise of the
|
TEST_LKM module except that it does a basic exercise of the
|
||||||
clear_bit and set_bit macros to make sure there are no compiler
|
set/clear_bit macros and get_count_order/long to make sure there are
|
||||||
warnings from C=1 sparse checker or -Wextra compilations. It has
|
no compiler warnings from C=1 sparse checker or -Wextra
|
||||||
no dependencies and doesn't run or load unless explicitly requested
|
compilations. It has no dependencies and doesn't run or load unless
|
||||||
by name. for example: modprobe test_bitops.
|
explicitly requested by name. for example: modprobe test_bitops.
|
||||||
|
|
||||||
If unsure, say N.
|
If unsure, say N.
|
||||||
|
|
||||||
|
|||||||
@@ -741,8 +741,9 @@ int bitmap_parse(const char *start, unsigned int buflen,
|
|||||||
int chunks = BITS_TO_U32(nmaskbits);
|
int chunks = BITS_TO_U32(nmaskbits);
|
||||||
u32 *bitmap = (u32 *)maskp;
|
u32 *bitmap = (u32 *)maskp;
|
||||||
int unset_bit;
|
int unset_bit;
|
||||||
|
int chunk;
|
||||||
|
|
||||||
while (1) {
|
for (chunk = 0; ; chunk++) {
|
||||||
end = bitmap_find_region_reverse(start, end);
|
end = bitmap_find_region_reverse(start, end);
|
||||||
if (start > end)
|
if (start > end)
|
||||||
break;
|
break;
|
||||||
@@ -750,7 +751,11 @@ int bitmap_parse(const char *start, unsigned int buflen,
|
|||||||
if (!chunks--)
|
if (!chunks--)
|
||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
|
|
||||||
end = bitmap_get_x32_reverse(start, end, bitmap++);
|
#if defined(CONFIG_64BIT) && defined(__BIG_ENDIAN)
|
||||||
|
end = bitmap_get_x32_reverse(start, end, &bitmap[chunk ^ 1]);
|
||||||
|
#else
|
||||||
|
end = bitmap_get_x32_reverse(start, end, &bitmap[chunk]);
|
||||||
|
#endif
|
||||||
if (IS_ERR(end))
|
if (IS_ERR(end))
|
||||||
return PTR_ERR(end);
|
return PTR_ERR(end);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ static FORCE_INLINE int LZ4_decompress_generic(
|
|||||||
* space in the output for those 18 bytes earlier, upon
|
* space in the output for those 18 bytes earlier, upon
|
||||||
* entering the shortcut (in other words, there is a
|
* entering the shortcut (in other words, there is a
|
||||||
* combined check for both stages).
|
* combined check for both stages).
|
||||||
|
*
|
||||||
|
* The & in the likely() below is intentionally not && so that
|
||||||
|
* some compilers can produce better parallelized runtime code
|
||||||
*/
|
*/
|
||||||
if ((endOnInput ? length != RUN_MASK : length <= 8)
|
if ((endOnInput ? length != RUN_MASK : length <= 8)
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
|
|
||||||
/* a tiny module only meant to test set/clear_bit */
|
/* a tiny module only meant to test
|
||||||
|
*
|
||||||
|
* set/clear_bit
|
||||||
|
* get_count_order/long
|
||||||
|
*/
|
||||||
|
|
||||||
/* use an enum because thats the most common BITMAP usage */
|
/* use an enum because thats the most common BITMAP usage */
|
||||||
enum bitops_fun {
|
enum bitops_fun {
|
||||||
@@ -24,14 +28,59 @@ enum bitops_fun {
|
|||||||
|
|
||||||
static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
|
static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
|
||||||
|
|
||||||
|
static unsigned int order_comb[][2] = {
|
||||||
|
{0x00000003, 2},
|
||||||
|
{0x00000004, 2},
|
||||||
|
{0x00001fff, 13},
|
||||||
|
{0x00002000, 13},
|
||||||
|
{0x50000000, 31},
|
||||||
|
{0x80000000, 31},
|
||||||
|
{0x80003000, 32},
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_64BIT
|
||||||
|
static unsigned long order_comb_long[][2] = {
|
||||||
|
{0x0000000300000000, 34},
|
||||||
|
{0x0000000400000000, 34},
|
||||||
|
{0x00001fff00000000, 45},
|
||||||
|
{0x0000200000000000, 45},
|
||||||
|
{0x5000000000000000, 63},
|
||||||
|
{0x8000000000000000, 63},
|
||||||
|
{0x8000300000000000, 64},
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static int __init test_bitops_startup(void)
|
static int __init test_bitops_startup(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
pr_warn("Loaded test module\n");
|
pr_warn("Loaded test module\n");
|
||||||
set_bit(BITOPS_4, g_bitmap);
|
set_bit(BITOPS_4, g_bitmap);
|
||||||
set_bit(BITOPS_7, g_bitmap);
|
set_bit(BITOPS_7, g_bitmap);
|
||||||
set_bit(BITOPS_11, g_bitmap);
|
set_bit(BITOPS_11, g_bitmap);
|
||||||
set_bit(BITOPS_31, g_bitmap);
|
set_bit(BITOPS_31, g_bitmap);
|
||||||
set_bit(BITOPS_88, g_bitmap);
|
set_bit(BITOPS_88, g_bitmap);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
|
||||||
|
if (order_comb[i][1] != get_count_order(order_comb[i][0]))
|
||||||
|
pr_warn("get_count_order wrong for %x\n",
|
||||||
|
order_comb[i][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
|
||||||
|
if (order_comb[i][1] != get_count_order_long(order_comb[i][0]))
|
||||||
|
pr_warn("get_count_order_long wrong for %x\n",
|
||||||
|
order_comb[i][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_64BIT
|
||||||
|
for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
|
||||||
|
if (order_comb_long[i][1] !=
|
||||||
|
get_count_order_long(order_comb_long[i][0]))
|
||||||
|
pr_warn("get_count_order_long wrong for %lx\n",
|
||||||
|
order_comb_long[i][0]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +104,6 @@ static void __exit test_bitops_unstartup(void)
|
|||||||
module_init(test_bitops_startup);
|
module_init(test_bitops_startup);
|
||||||
module_exit(test_bitops_unstartup);
|
module_exit(test_bitops_unstartup);
|
||||||
|
|
||||||
MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>");
|
MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>, Wei Yang <richard.weiyang@gmail.com>");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_DESCRIPTION("Bit testing module");
|
MODULE_DESCRIPTION("Bit testing module");
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
|
|||||||
maccess.o page-writeback.o \
|
maccess.o page-writeback.o \
|
||||||
readahead.o swap.o truncate.o vmscan.o shmem.o \
|
readahead.o swap.o truncate.o vmscan.o shmem.o \
|
||||||
util.o mmzone.o vmstat.o backing-dev.o \
|
util.o mmzone.o vmstat.o backing-dev.o \
|
||||||
mm_init.o mmu_context.o percpu.o slab_common.o \
|
mm_init.o percpu.o slab_common.o \
|
||||||
compaction.o vmacache.o \
|
compaction.o vmacache.o \
|
||||||
interval_tree.o list_lru.o workingset.o \
|
interval_tree.o list_lru.o workingset.o \
|
||||||
debug.o gup.o $(mmu-y)
|
debug.o gup.o $(mmu-y)
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot)
|
|||||||
{
|
{
|
||||||
pmd_t pmd = pfn_pmd(pfn, prot);
|
pmd_t pmd = pfn_pmd(pfn, prot);
|
||||||
|
|
||||||
|
if (!has_transparent_hugepage())
|
||||||
|
return;
|
||||||
|
|
||||||
WARN_ON(!pmd_same(pmd, pmd));
|
WARN_ON(!pmd_same(pmd, pmd));
|
||||||
WARN_ON(!pmd_young(pmd_mkyoung(pmd_mkold(pmd))));
|
WARN_ON(!pmd_young(pmd_mkyoung(pmd_mkold(pmd))));
|
||||||
WARN_ON(!pmd_dirty(pmd_mkdirty(pmd_mkclean(pmd))));
|
WARN_ON(!pmd_dirty(pmd_mkdirty(pmd_mkclean(pmd))));
|
||||||
@@ -79,6 +82,9 @@ static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot)
|
|||||||
{
|
{
|
||||||
pud_t pud = pfn_pud(pfn, prot);
|
pud_t pud = pfn_pud(pfn, prot);
|
||||||
|
|
||||||
|
if (!has_transparent_hugepage())
|
||||||
|
return;
|
||||||
|
|
||||||
WARN_ON(!pud_same(pud, pud));
|
WARN_ON(!pud_same(pud, pud));
|
||||||
WARN_ON(!pud_young(pud_mkyoung(pud_mkold(pud))));
|
WARN_ON(!pud_young(pud_mkyoung(pud_mkold(pud))));
|
||||||
WARN_ON(!pud_write(pud_mkwrite(pud_wrprotect(pud))));
|
WARN_ON(!pud_write(pud_mkwrite(pud_wrprotect(pud))));
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
/* Copyright (C) 2009 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* See ../COPYING for licensing terms.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/mm.h>
|
|
||||||
#include <linux/sched.h>
|
|
||||||
#include <linux/sched/mm.h>
|
|
||||||
#include <linux/sched/task.h>
|
|
||||||
#include <linux/mmu_context.h>
|
|
||||||
#include <linux/export.h>
|
|
||||||
|
|
||||||
#include <asm/mmu_context.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* use_mm
|
|
||||||
* Makes the calling kernel thread take on the specified
|
|
||||||
* mm context.
|
|
||||||
* (Note: this routine is intended to be called only
|
|
||||||
* from a kernel thread context)
|
|
||||||
*/
|
|
||||||
void use_mm(struct mm_struct *mm)
|
|
||||||
{
|
|
||||||
struct mm_struct *active_mm;
|
|
||||||
struct task_struct *tsk = current;
|
|
||||||
|
|
||||||
task_lock(tsk);
|
|
||||||
active_mm = tsk->active_mm;
|
|
||||||
if (active_mm != mm) {
|
|
||||||
mmgrab(mm);
|
|
||||||
tsk->active_mm = mm;
|
|
||||||
}
|
|
||||||
tsk->mm = mm;
|
|
||||||
switch_mm(active_mm, mm, tsk);
|
|
||||||
task_unlock(tsk);
|
|
||||||
#ifdef finish_arch_post_lock_switch
|
|
||||||
finish_arch_post_lock_switch();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (active_mm != mm)
|
|
||||||
mmdrop(active_mm);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(use_mm);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* unuse_mm
|
|
||||||
* Reverses the effect of use_mm, i.e. releases the
|
|
||||||
* specified mm context which was earlier taken on
|
|
||||||
* by the calling kernel thread
|
|
||||||
* (Note: this routine is intended to be called only
|
|
||||||
* from a kernel thread context)
|
|
||||||
*/
|
|
||||||
void unuse_mm(struct mm_struct *mm)
|
|
||||||
{
|
|
||||||
struct task_struct *tsk = current;
|
|
||||||
|
|
||||||
task_lock(tsk);
|
|
||||||
sync_mm_rss(mm);
|
|
||||||
tsk->mm = NULL;
|
|
||||||
/* active_mm is still 'mm' */
|
|
||||||
enter_lazy_tlb(mm, tsk);
|
|
||||||
task_unlock(tsk);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(unuse_mm);
|
|
||||||
@@ -126,7 +126,7 @@ static bool oom_cpuset_eligible(struct task_struct *tsk, struct oom_control *oc)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The process p may have detached its own ->mm while exiting or through
|
* The process p may have detached its own ->mm while exiting or through
|
||||||
* use_mm(), but one or more of its subthreads may still have a valid
|
* kthread_use_mm(), but one or more of its subthreads may still have a valid
|
||||||
* pointer. Return p, or any of its subthreads with a valid ->mm, with
|
* pointer. Return p, or any of its subthreads with a valid ->mm, with
|
||||||
* task_lock() held.
|
* task_lock() held.
|
||||||
*/
|
*/
|
||||||
@@ -919,8 +919,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* No use_mm() user needs to read from the userspace so we are
|
* No kthead_use_mm() user needs to read from the userspace so
|
||||||
* ok to reap it.
|
* we are ok to reap it.
|
||||||
*/
|
*/
|
||||||
if (unlikely(p->flags & PF_KTHREAD))
|
if (unlikely(p->flags & PF_KTHREAD))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
* task's vmacache pertains to a different mm (ie, its own). There is
|
* task's vmacache pertains to a different mm (ie, its own). There is
|
||||||
* nothing we can do here.
|
* nothing we can do here.
|
||||||
*
|
*
|
||||||
* Also handle the case where a kernel thread has adopted this mm via use_mm().
|
* Also handle the case where a kernel thread has adopted this mm via
|
||||||
* That kernel thread's vmacache is not applicable to this mm.
|
* kthread_use_mm(). That kernel thread's vmacache is not applicable to this mm.
|
||||||
*/
|
*/
|
||||||
static inline bool vmacache_valid_mm(struct mm_struct *mm)
|
static inline bool vmacache_valid_mm(struct mm_struct *mm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2407,7 +2407,7 @@ sub process {
|
|||||||
|
|
||||||
if ($rawline=~/^\+\+\+\s+(\S+)/) {
|
if ($rawline=~/^\+\+\+\s+(\S+)/) {
|
||||||
$setup_docs = 0;
|
$setup_docs = 0;
|
||||||
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
|
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.txt$@) {
|
||||||
$setup_docs = 1;
|
$setup_docs = 1;
|
||||||
}
|
}
|
||||||
#next;
|
#next;
|
||||||
@@ -6388,7 +6388,7 @@ sub process {
|
|||||||
|
|
||||||
if (!grep(/$name/, @setup_docs)) {
|
if (!grep(/$name/, @setup_docs)) {
|
||||||
CHK("UNDOCUMENTED_SETUP",
|
CHK("UNDOCUMENTED_SETUP",
|
||||||
"__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.rst\n" . $herecurr);
|
"__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.txt\n" . $herecurr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ actualy||actually
|
|||||||
acumulating||accumulating
|
acumulating||accumulating
|
||||||
acumulative||accumulative
|
acumulative||accumulative
|
||||||
acumulator||accumulator
|
acumulator||accumulator
|
||||||
|
acutally||actually
|
||||||
adapater||adapter
|
adapater||adapter
|
||||||
addional||additional
|
addional||additional
|
||||||
additionaly||additionally
|
additionaly||additionally
|
||||||
@@ -249,6 +250,7 @@ calescing||coalescing
|
|||||||
calle||called
|
calle||called
|
||||||
callibration||calibration
|
callibration||calibration
|
||||||
callled||called
|
callled||called
|
||||||
|
callser||caller
|
||||||
calucate||calculate
|
calucate||calculate
|
||||||
calulate||calculate
|
calulate||calculate
|
||||||
cancelation||cancellation
|
cancelation||cancellation
|
||||||
@@ -671,6 +673,7 @@ hanlde||handle
|
|||||||
hanled||handled
|
hanled||handled
|
||||||
happend||happened
|
happend||happened
|
||||||
harware||hardware
|
harware||hardware
|
||||||
|
havind||having
|
||||||
heirarchically||hierarchically
|
heirarchically||hierarchically
|
||||||
helpfull||helpful
|
helpfull||helpful
|
||||||
hexdecimal||hexadecimal
|
hexdecimal||hexadecimal
|
||||||
@@ -845,6 +848,7 @@ logile||logfile
|
|||||||
loobpack||loopback
|
loobpack||loopback
|
||||||
loosing||losing
|
loosing||losing
|
||||||
losted||lost
|
losted||lost
|
||||||
|
maangement||management
|
||||||
machinary||machinery
|
machinary||machinery
|
||||||
maibox||mailbox
|
maibox||mailbox
|
||||||
maintainance||maintenance
|
maintainance||maintenance
|
||||||
@@ -905,6 +909,7 @@ modfiy||modify
|
|||||||
modulues||modules
|
modulues||modules
|
||||||
momery||memory
|
momery||memory
|
||||||
memomry||memory
|
memomry||memory
|
||||||
|
monitring||monitoring
|
||||||
monochorome||monochrome
|
monochorome||monochrome
|
||||||
monochromo||monochrome
|
monochromo||monochrome
|
||||||
monocrome||monochrome
|
monocrome||monochrome
|
||||||
@@ -1010,6 +1015,7 @@ partiton||partition
|
|||||||
pased||passed
|
pased||passed
|
||||||
passin||passing
|
passin||passing
|
||||||
pathes||paths
|
pathes||paths
|
||||||
|
pattrns||patterns
|
||||||
pecularities||peculiarities
|
pecularities||peculiarities
|
||||||
peformance||performance
|
peformance||performance
|
||||||
peforming||performing
|
peforming||performing
|
||||||
@@ -1256,6 +1262,7 @@ shoule||should
|
|||||||
shrinked||shrunk
|
shrinked||shrunk
|
||||||
siginificantly||significantly
|
siginificantly||significantly
|
||||||
signabl||signal
|
signabl||signal
|
||||||
|
significanly||significantly
|
||||||
similary||similarly
|
similary||similarly
|
||||||
similiar||similar
|
similiar||similar
|
||||||
simlar||similar
|
simlar||similar
|
||||||
@@ -1371,6 +1378,7 @@ thead||thread
|
|||||||
therfore||therefore
|
therfore||therefore
|
||||||
thier||their
|
thier||their
|
||||||
threds||threads
|
threds||threads
|
||||||
|
threee||three
|
||||||
threshhold||threshold
|
threshhold||threshold
|
||||||
thresold||threshold
|
thresold||threshold
|
||||||
throught||through
|
throught||through
|
||||||
@@ -1410,6 +1418,7 @@ tyep||type
|
|||||||
udpate||update
|
udpate||update
|
||||||
uesd||used
|
uesd||used
|
||||||
uknown||unknown
|
uknown||unknown
|
||||||
|
usccess||success
|
||||||
usupported||unsupported
|
usupported||unsupported
|
||||||
uncommited||uncommitted
|
uncommited||uncommitted
|
||||||
unconditionaly||unconditionally
|
unconditionaly||unconditionally
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ static bool wait_for_scan(const char *msg, char *p)
|
|||||||
|
|
||||||
madvise(p, hpage_pmd_size, MADV_NOHUGEPAGE);
|
madvise(p, hpage_pmd_size, MADV_NOHUGEPAGE);
|
||||||
|
|
||||||
return !timeout;
|
return timeout == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void alloc_at_fault(void)
|
static void alloc_at_fault(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user