From patchwork Sun Jun 16 08:58:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Natalenko X-Patchwork-Id: 10997309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF845924 for ; Sun, 16 Jun 2019 08:58:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B16D6286F7 for ; Sun, 16 Jun 2019 08:58:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5CF22879E; Sun, 16 Jun 2019 08:58:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E23286F7 for ; Sun, 16 Jun 2019 08:58:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 467DB8E0002; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3F1038E0001; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26E0D8E0002; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id CF27E8E0001 for ; Sun, 16 Jun 2019 04:58:41 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id r4so3218520wrt.13 for ; Sun, 16 Jun 2019 01:58:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PJSsC+ETTbEm0MFSswbRZG13yzb82K1kjBPqEvVe/Y8=; b=P0WQjDPi6yIdulLFN8DFjT64Da8/ylJn5kmWZncfaEltTd40HK7Mi99ezEvEfr1c2R RXuTjKwFfPN+wTtNRDQJBz6qZ4xL3tCOmARi+SzcX7ZtykrCzwd0A0YzGTwhxdATGd65 YX+FRTL+sbrd+LiWnZp9/lwIik7R5CrDmuymBvioxQAslViTJjjkN3OMdxiGwUYC2f/T kR3PSJxYLZF0odWVsOl13x3E57HUCW4wapT734b6pAlnObO+CVKZSDZRMnMiGrRi0e65 S2iGr76J3sGnHsIR7b1yyu/aLZvmfVIctHVoZlJxsYFrbKs5exfTRoUzzmOKg2L70d5s CNTg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUoRYadEOLHEmMoFjtrN3nINH/91M8KZymKoOasDjGYQrZs/rta n2hWea3MeAEW4a+Tqfkbiui15FN79Ei74cuQ2cpi3ZlFbW+3b4KaYNubsYkmYrnnW5+1lIChe5S 74E8gWqg3oaaUycbqvl04NEe9tp0IfonpNwEqQ5Rpwg5dHbQNSGn+UbFmMX2YU9M+Uw== X-Received: by 2002:a05:6000:1203:: with SMTP id e3mr7210657wrx.300.1560675521207; Sun, 16 Jun 2019 01:58:41 -0700 (PDT) X-Received: by 2002:a05:6000:1203:: with SMTP id e3mr7210586wrx.300.1560675519931; Sun, 16 Jun 2019 01:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560675519; cv=none; d=google.com; s=arc-20160816; b=z1oXcwUvdaIS8iS7VG/hvPEWA+7Xlx73nEZf5+5Wi4/VehfzGANoeIbXmAgv3q+qWL RGlpek7+FtSAe7UjD6CkLMh7MvGHIA/lzpXibhkg83RRo+TN4Vas1EJPcfpRfU5jsOb4 wwqBGa7Sq4hQN/M6V/7T2JmvPwxJDLnBc+PbRUk85oHwfL/aLCetfcw1Wt9EhYnKU3lu 4rBJQYKXYhYM5O8o7QGcITfKsL+Xx+VGnbUaF5jPD+BqwJ5fvHpzPPrFDTp0yG6tsMqB tAv7mXQh/YZQGlC86oceETv41GZ7yd9vrL81r585gyo2y1mhQDFPQWEbVlgpASUw0im5 3+4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=PJSsC+ETTbEm0MFSswbRZG13yzb82K1kjBPqEvVe/Y8=; b=ni84UP5OX55200Bo/kaPNvZiodFkycu3flxdoyl2hGRC2v8JJJFxXm9rnAyihTcR35 YEQH8Oy/0h0tsFpR30UCvXYdhXLFXbOw973xBlalXvQxnZNIRD+BiminO+zzXEEs+ZKX gyuCORdcmdiJ8BJq1p+F4Dt/udMW0BdQDGLhZMa8mDLNTjgaeKvdSxobxb+gSeevXVXn OQUQB1HGYgciRQLMUSW2ZpS0u6stXUPf/7/KtZ758PqAHZ40Dz1PzAN8ho2Ud0rCdEaw XxAjSqOoLTRlTixHdjb0So4ul1drs9enrAVi5Hj/KbO/d53zvig+fRvGER6wFYtbkGle 3XUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b203sor4307600wmh.13.2019.06.16.01.58.39 for (Google Transport Security); Sun, 16 Jun 2019 01:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Google-Smtp-Source: APXvYqziZjswyLaPjH4zzuukgwYGgZMcx72QbU3TZfm0v5QbPhsR4W+rR5m+8XGdtVYkv9SHvMzBoA== X-Received: by 2002:a1c:99c6:: with SMTP id b189mr14663437wme.57.1560675519453; Sun, 16 Jun 2019 01:58:39 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 6sm8148471wrd.51.2019.06.16.01.58.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 01:58:38 -0700 (PDT) From: Oleksandr Natalenko To: Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH NOTFORMERGE 1/5] mm: rename madvise_core to madvise_common Date: Sun, 16 Jun 2019 10:58:31 +0200 Message-Id: <20190616085835.953-2-oleksandr@redhat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190616085835.953-1-oleksandr@redhat.com> References: <20190616085835.953-1-oleksandr@redhat.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP "core" usually means something very different within the kernel land, thus lets just follow the way it is handled in mutexes, rw_semaphores etc and name common things as "_common". Signed-off-by: Oleksandr Natalenko --- mm/madvise.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index 94d782097afd..edb7184f665c 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -998,7 +998,7 @@ process_madvise_behavior_valid(int behavior) } /* - * madvise_core - request behavior hint to address range of the target process + * madvise_common - request behavior hint to address range of the target process * * @task: task_struct got behavior hint, not giving the hint * @mm: mm_struct got behavior hint, not giving the hint @@ -1009,7 +1009,7 @@ process_madvise_behavior_valid(int behavior) * @task could be a zombie leader if it calls sys_exit so accessing mm_struct * via task->mm is prohibited. Please use @mm insetad of task->mm. */ -static int madvise_core(struct task_struct *task, struct mm_struct *mm, +static int madvise_common(struct task_struct *task, struct mm_struct *mm, unsigned long start, size_t len_in, int behavior) { unsigned long end, tmp; @@ -1132,7 +1132,7 @@ static int pr_madvise_copy_param(struct pr_madvise_param __user *u_param, return ret; } -static int process_madvise_core(struct task_struct *tsk, struct mm_struct *mm, +static int process_madvise_common(struct task_struct *tsk, struct mm_struct *mm, int *behaviors, struct iov_iter *iter, const struct iovec *range_vec, @@ -1144,7 +1144,7 @@ static int process_madvise_core(struct task_struct *tsk, struct mm_struct *mm, for (i = 0; i < riovcnt && iov_iter_count(iter); i++) { err = -EINVAL; if (process_madvise_behavior_valid(behaviors[i])) - err = madvise_core(tsk, mm, + err = madvise_common(tsk, mm, (unsigned long)range_vec[i].iov_base, range_vec[i].iov_len, behaviors[i]); @@ -1220,7 +1220,7 @@ static int process_madvise_core(struct task_struct *tsk, struct mm_struct *mm, */ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior) { - return madvise_core(current, current->mm, start, len_in, behavior); + return madvise_common(current, current->mm, start, len_in, behavior); } @@ -1252,7 +1252,7 @@ SYSCALL_DEFINE3(process_madvise, int, pidfd, /* * We don't support cookie to gaurantee address space atomicity yet. - * Once we implment cookie, process_madvise_core need to hold mmap_sme + * Once we implment cookie, process_madvise_common need to hold mmap_sme * during entire operation to guarantee atomicity. */ if (params.cookie != 0) @@ -1316,7 +1316,7 @@ SYSCALL_DEFINE3(process_madvise, int, pidfd, goto release_task; } - ret = process_madvise_core(task, mm, behaviors, &iter, iov_r, nr_elem); + ret = process_madvise_common(task, mm, behaviors, &iter, iov_r, nr_elem); mmput(mm); release_task: put_task_struct(task); From patchwork Sun Jun 16 08:58:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Natalenko X-Patchwork-Id: 10997311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B97714B6 for ; Sun, 16 Jun 2019 08:58:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4CB286F7 for ; Sun, 16 Jun 2019 08:58:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11D412879E; Sun, 16 Jun 2019 08:58:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7382286F7 for ; Sun, 16 Jun 2019 08:58:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB5BB8E0003; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D68F18E0001; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7C618E0003; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by kanga.kvack.org (Postfix) with ESMTP id 9445D8E0001 for ; Sun, 16 Jun 2019 04:58:42 -0400 (EDT) Received: by mail-wm1-f72.google.com with SMTP id z202so1032403wmc.9 for ; Sun, 16 Jun 2019 01:58:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3ITCIjtRiKXBETAqnfXapAAbycKyMBn7c3dUFh4aTVw=; b=d/jH5t02Hxn1WHwiY0sT7+YZ+EtAjGto32AlRVz1Qkv3AcS/AbsUXiDQRmNc7ASXY7 DWpDVyo9xRyh9/BK2flhInUnU9TJs+4U5F6TrsBM519d9GKrkwtFRElf/iTwz/LQSz8C iHhfCgB6oPWT9Z+qyZtXfaa4JOfyRJHAXe5QeMms18tBEiwIFxbeZN9fhNQ9/MTs5PAJ 96jqJ2wtahXZoJtg4B7Yk2ccWc++ARiaIuzkggLIZmwvTHWRIa7VC8/RAZTLqO93G7XW JY3XMwtrXFjmyMbNp0S1Y9Tt6DIE7p7bQ4y2tZhVmfaKOkcy+uELzEwW2ifQFeoFz+k7 DnXA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUIiN+KoUf1XTvK2RkNsbXk/rgfyQnT2Vf5zg05MZ0RhhM1D8UA lliD61GUYtdeI5MQ05W4lZtHFklm2haG9Kd+KD53OuQle5bT+OpWmEI/COq1uJZy3i73uB07VsA DttIDZCfUX4VkiWzRThphvj0YAvdbP7aFtuBezJPqhAVN5M4kgadWPXsk9NwelBt4+Q== X-Received: by 2002:a5d:46c7:: with SMTP id g7mr19309378wrs.215.1560675522074; Sun, 16 Jun 2019 01:58:42 -0700 (PDT) X-Received: by 2002:a5d:46c7:: with SMTP id g7mr19309312wrs.215.1560675521147; Sun, 16 Jun 2019 01:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560675521; cv=none; d=google.com; s=arc-20160816; b=Lg4TdIsZMrHXB5lhymcBDVgUQIiFTQ/8TCqVOMBPNad4+0H6MJqd/21Wx20IvVneuG DPMBSS0COz12JoDUxrXsjMN3zf8pgjgCrACqTJUGWlKVyBBQcuqP2Y0fSwn3JLLdvtsR 15Imq4IZUR5lNEvFP//lWPRZVu1ewkJW6WkcqHGSYeM2ZxnS5LROKhj12HdVIxi2rGry 49zCuSvwBZ61SphfIRRWwHvpam+/qDGU5gtQ8US02LzlBzSqM5fOjAsKZfIQtmkCDL1A AzMuaYuiY9GJwyYUfnWZcg8+KbHeyDCkgNTamnRZnkwWsjmgIlZfo/WKKAoAe67yV13c E9kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=3ITCIjtRiKXBETAqnfXapAAbycKyMBn7c3dUFh4aTVw=; b=FlQDWWCVJdWNKTn6LbsfXX+jx0g3q6J/iDQS38Oxd1YyOZBqifsGUMa+0kR3Jwuy8/ knyDGF9nHEGxVwXuHok7zMl7u5gArCNIqq81NGgYJoGJ+un2Qq/9/b9cElbmGVdxqpud OrDKsoTzvF/4NSow8uhm5DOSmRbR7MZ73rTRHyIRRqxzoZOACb+pNH8B3i2qgLgLih8f l29nFZWO6Z32pcoasRnvK/FxaYaPD3ohVj5JVnFGNS1lBbyMvdDdPbCg0lHIJCC72Hjc HcGdpMpspQBOD1k9/66OuBfJGNuVuZ8zzYFMcSckzDiEHTG9zoqGmAZi0bX8LiVmABFm 7bmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m9sor5754549wru.1.2019.06.16.01.58.41 for (Google Transport Security); Sun, 16 Jun 2019 01:58:41 -0700 (PDT) Received-SPF: pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Google-Smtp-Source: APXvYqzQMjvzDFYnOgTdFM99hcnJUp0/uTV59QLuRVfafS23C/DUgS5gTgJZNRO0B4DaEtyvurzykA== X-Received: by 2002:a5d:6a42:: with SMTP id t2mr6432594wrw.352.1560675520784; Sun, 16 Jun 2019 01:58:40 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id t1sm7728752wra.74.2019.06.16.01.58.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 01:58:40 -0700 (PDT) From: Oleksandr Natalenko To: Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH NOTFORMERGE 2/5] mm: revert madvise_inject_error line split Date: Sun, 16 Jun 2019 10:58:32 +0200 Message-Id: <20190616085835.953-3-oleksandr@redhat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190616085835.953-1-oleksandr@redhat.com> References: <20190616085835.953-1-oleksandr@redhat.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Just to highlight it after our conversation. Signed-off-by: Oleksandr Natalenko --- mm/madvise.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index edb7184f665c..70aeb54f3e1c 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1041,8 +1041,7 @@ static int madvise_common(struct task_struct *task, struct mm_struct *mm, #ifdef CONFIG_MEMORY_FAILURE if (behavior == MADV_HWPOISON || behavior == MADV_SOFT_OFFLINE) - return madvise_inject_error(behavior, - start, start + len_in); + return madvise_inject_error(behavior, start, start + len_in); #endif write = madvise_need_mmap_write(behavior); From patchwork Sun Jun 16 08:58:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Natalenko X-Patchwork-Id: 10997313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 069A014B6 for ; Sun, 16 Jun 2019 08:58:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBD90286F7 for ; Sun, 16 Jun 2019 08:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0317287C2; Sun, 16 Jun 2019 08:58:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91824286F7 for ; Sun, 16 Jun 2019 08:58:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32ED98E0004; Sun, 16 Jun 2019 04:58:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2E39C8E0001; Sun, 16 Jun 2019 04:58:44 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10C548E0004; Sun, 16 Jun 2019 04:58:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id CA7C78E0001 for ; Sun, 16 Jun 2019 04:58:43 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id r4so3218550wrt.13 for ; Sun, 16 Jun 2019 01:58:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2sgxUU390W2PtuQ88MMXWGwjdnv5ZXrQD67uDLz3qgg=; b=mytxanDarCPzxtLre3bVFL9aRplBOMCtrhG8xhJb1CDqb/AfI/7xtx8sCgYbodIZtS aUKUxhL0vWRw1rG9LnTucE1PeE0y+hC2iBjDNR9mqu9nP/6Y+dsur3OIsRR0IVEMoiHJ 2mu+SqhdnjZhPBBs3Opw0QncE1orXowEe9+iblFryIThAHhUaoPsRdHiPs1v+3ix38R5 PAQoudKu1HpxBvqxYMqwhQcEFbZqzYfIf8WQlvv76OVvALqBp28fr0r4papNT5OY2++7 Cy2EDUzgrjupVNbF/9Qh75vdOt6Pv4mmwc4ydbw1lazQLAG2y8WmVuAkUEufNP2c5gq+ yUQg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUl+9RMzElJfThrA30iIjX4RAkvXc9XltEFplVkCM1Ap7KjSP0B wcxQko0hj+AEbhal5XaxV9fi3dEgIZmmNaWXJNhWoC7JGzVn11NL0tqWybvRA2Y1kMap7GQBy2S e5vUOXw5RPHmH8g/jmq2Gkd3jhSI/obUlTyPAS14IEZGucpGqWZSHgz7lnDODSJGY5A== X-Received: by 2002:adf:ce82:: with SMTP id r2mr9934089wrn.223.1560675523327; Sun, 16 Jun 2019 01:58:43 -0700 (PDT) X-Received: by 2002:adf:ce82:: with SMTP id r2mr9934031wrn.223.1560675522521; Sun, 16 Jun 2019 01:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560675522; cv=none; d=google.com; s=arc-20160816; b=j8W0QJs66Q7CRm/RE+2/kNUW1Dp3DiIZSY+t6g4p/jgjjFbhd/8IVv3evC+hrWlZ/h fDy2wZeFk7IPSA/HV7ljGktC3Om30F+FI64vntOCjEcBMJSD7ceokS66AkzVB2CQ3q3q BaHAkIqJW9mSDgQWzCiKcyl55esalA0SHKc05XSyTJYb8BA8T4r459uotxk9t0WitM8l vWRvxsvpHntA+EVqOED9tu04NTbrjEm+DTDmSaCNFvJTNHce1qQgDFKBor2R11LOXlOL yAZGR+8Y+z6cUeRQbvxFi6D2wtzD571I/VcMNqwK2G+GOVr4seX7jFDatrMQVyc4nOcB 7PDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=2sgxUU390W2PtuQ88MMXWGwjdnv5ZXrQD67uDLz3qgg=; b=guNHBzXlhFJv34knZnI2Qh9BlDZjhwMtOO48SJgXjYKfBjwo6sCZCIM2PIh4Iv02jt a2SuzItUOhHi6SWpuVuZrIfKAH69r2tfSYSD3/xnqLX3sr3D06ei7E0vWOxiFSQUlSM9 6P5HIhOzgKzZALrSuflDo+yzg8fQeVBysZ1cht0LK3waU+ylmVeaHcAGuHSAR7DYaH4L k/RCt84yd1c2PAsTupc6/lriifH1Faji5Dhh7HcT85S1F4IE2Cukau/8G2Clz1qfR2tf rN0rG81apAVPFk6V2kISPPwYh8DYcAl0rbh0WYRcoxw/DmwreK7vTEZACAE9f4BWUVV/ W9BQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d1sor3174605wrm.51.2019.06.16.01.58.42 for (Google Transport Security); Sun, 16 Jun 2019 01:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Google-Smtp-Source: APXvYqwX2256HeSx7fk/qLqgGOiy/mrmlvd+nYfLi1zyyw8W3Dtaz40qJJqmoIRaEQdsdMHYjWP9JQ== X-Received: by 2002:adf:f610:: with SMTP id t16mr9367740wrp.3.1560675522190; Sun, 16 Jun 2019 01:58:42 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id h90sm18578838wrh.15.2019.06.16.01.58.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 01:58:41 -0700 (PDT) From: Oleksandr Natalenko To: Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH NOTFORMERGE 3/5] mm: include uio.h to madvise.c Date: Sun, 16 Jun 2019 10:58:33 +0200 Message-Id: <20190616085835.953-4-oleksandr@redhat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190616085835.953-1-oleksandr@redhat.com> References: <20190616085835.953-1-oleksandr@redhat.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP I couldn't compile it w/o this header. Signed-off-by: Oleksandr Natalenko --- mm/madvise.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/madvise.c b/mm/madvise.c index 70aeb54f3e1c..9755340da157 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -25,6 +25,7 @@ #include #include #include +#include #include From patchwork Sun Jun 16 08:58:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Natalenko X-Patchwork-Id: 10997315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E717D924 for ; Sun, 16 Jun 2019 08:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D987F286F7 for ; Sun, 16 Jun 2019 08:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC24A287C2; Sun, 16 Jun 2019 08:58:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6AC286F7 for ; Sun, 16 Jun 2019 08:58:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 704D28E0005; Sun, 16 Jun 2019 04:58:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 63F918E0001; Sun, 16 Jun 2019 04:58:45 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52C798E0005; Sun, 16 Jun 2019 04:58:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by kanga.kvack.org (Postfix) with ESMTP id 1D1A38E0001 for ; Sun, 16 Jun 2019 04:58:45 -0400 (EDT) Received: by mail-wm1-f70.google.com with SMTP id u17so1032458wmd.6 for ; Sun, 16 Jun 2019 01:58:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BH7q4sQxtlW7GBy0Ndsur0wfVLJQqa1DwxMiAYKl/M8=; b=dJ7Ym0q80iAZqo6WpGnwJBpyvRKn9kvtfBHFK9BQlhMmIPbUBkI9a23S+yDrhuF4UG f18iQG+j97bINxQP8HBLAsiGGvTTosKjFkoLeJQM4ScyMDHWxubDX7U4jBgo4NsaxGCo n+ZDihRLnTGQUlz+QXkCrJfE0p0JN1Dh3C30vgSNS1Nf1/kIVHZzzUNAc0idq5sjeGzx xBB10+FBEfEBtZHTJRt1QBn+OKQcrnbAmRbrCPzgVhwuX4w4GzMYynz/36aioV07B9PG A8eWZ5OhpM2V0lbdEo8x9lU/r15Cm6WK25RHMeDENfCRGpqp+mGFXFxdqA+n6k5DYeW7 xSlw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAXYkykA8yqf6HuUkoDYuu3ZhGvdyFq3CcmoZujA+8IQhUmZs/R6 6mqyw7CPzZE0DckZZJVsidtC93co2Nn4NRfWqArLNBH2HiMDvpEqJaQuCNon9yHlb+N9ejg/Aq8 uFjWqKijrNaq8T6CPx92jwU8OElCp8g5TRUo9HIQpcGxAD4YTcshELegNqtDVOGuGFQ== X-Received: by 2002:a5d:6212:: with SMTP id y18mr24176816wru.178.1560675524667; Sun, 16 Jun 2019 01:58:44 -0700 (PDT) X-Received: by 2002:a5d:6212:: with SMTP id y18mr24176778wru.178.1560675523983; Sun, 16 Jun 2019 01:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560675523; cv=none; d=google.com; s=arc-20160816; b=RW6Tmnf4UXWb5X95jwjlCr5lEJNGFwOq7JMnIT3JIzqpR1dQJ//oSw98E49K4bkV/5 ddoFtLn9GOoml9ocmePvrfs9eNWRDB1lfxub54PK6zp4nvd9APa8iUtYuqpzUaL/xgpg xPw2oSaOl4L+Tj9zjUDofIDQnG2vvSEgIqFDJOobwER5WukANEW0O4xgz+cH3mbtueCR RNBbsJnoGVBGqw2BaO8PX0gxfDItMBRWDsNgaF/RtleB+57MWe/iwCo+ndn0va1yO9NB JXJAda8iJzMf997pmsRV3qY/MOSNjCqA1D439EWTXlLwX2LnFhjgWAmPj/MZZolQ+HNJ ayXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=BH7q4sQxtlW7GBy0Ndsur0wfVLJQqa1DwxMiAYKl/M8=; b=YaLEAo1ealArPJPiCOWFUncelP9JkUX7ejY2R3s3L84/ERRV0NnBD5hdHrgA274Mbq bwIoT5tdn6P2v1mb36CicQXGNvkfEJOTTINew+r4iBkU11ZM988X/b/rn1KXrBVYo3wj KXGU0lrbpWLCfwFuiHQ+KlsRepzNPf07Oj/rqRNa6nMoDjqMSnKfrKbDa0fVHUitLbT/ Pb0J4iC0dMddOk6UApjdk86XJXySlHnVhVPpG/4Ej7bqmgnn1csclAg5ou3N7byexzGu JuBFqkTO/117IjAHSfZ5PP0luCM7YpksKxGdSB/G7D8kFmFALre9hQN3U0ew76JxUbZa dPKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w10sor5737969wrl.40.2019.06.16.01.58.43 for (Google Transport Security); Sun, 16 Jun 2019 01:58:43 -0700 (PDT) Received-SPF: pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Google-Smtp-Source: APXvYqz8xNHGO6SpiHfeRXmpPOlMaBmRTs2Z+ZnB2utwNn6Sw4tv3GLfcp5kGY1tE4/gW0/NkQufFQ== X-Received: by 2002:a5d:5702:: with SMTP id a2mr28113288wrv.89.1560675523661; Sun, 16 Jun 2019 01:58:43 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id e7sm6195627wmd.0.2019.06.16.01.58.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 01:58:43 -0700 (PDT) From: Oleksandr Natalenko To: Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH NOTFORMERGE 4/5] mm/madvise: employ mmget_still_valid for write lock Date: Sun, 16 Jun 2019 10:58:34 +0200 Message-Id: <20190616085835.953-5-oleksandr@redhat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190616085835.953-1-oleksandr@redhat.com> References: <20190616085835.953-1-oleksandr@redhat.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Do the very same trick as we already do since 04f5866e41fb. KSM hints will require locking mmap_sem for write since they modify vm_flags, so for remote KSM hinting this additional check is needed. Signed-off-by: Oleksandr Natalenko --- mm/madvise.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/madvise.c b/mm/madvise.c index 9755340da157..84f899b1b6da 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1049,6 +1049,8 @@ static int madvise_common(struct task_struct *task, struct mm_struct *mm, if (write) { if (down_write_killable(&mm->mmap_sem)) return -EINTR; + if (current->mm != mm && !mmget_still_valid(mm)) + goto skip_mm; } else { down_read(&mm->mmap_sem); } @@ -1099,6 +1101,7 @@ static int madvise_common(struct task_struct *task, struct mm_struct *mm, } out: blk_finish_plug(&plug); +skip_mm: if (write) up_write(&mm->mmap_sem); else From patchwork Sun Jun 16 08:58:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Natalenko X-Patchwork-Id: 10997317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D06C714B6 for ; Sun, 16 Jun 2019 08:58:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C19F8286F7 for ; Sun, 16 Jun 2019 08:58:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5ADD2879E; Sun, 16 Jun 2019 08:58:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54417286F7 for ; Sun, 16 Jun 2019 08:58:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DDDF8E0006; Sun, 16 Jun 2019 04:58:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 419E28E0001; Sun, 16 Jun 2019 04:58:47 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 309EF8E0006; Sun, 16 Jun 2019 04:58:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id CD0078E0001 for ; Sun, 16 Jun 2019 04:58:46 -0400 (EDT) Received: by mail-wr1-f72.google.com with SMTP id c6so2742842wrp.11 for ; Sun, 16 Jun 2019 01:58:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hjjZi7hVawe1O5sE3agHwwCxgHKG18ng7v/8qT0V/18=; b=Sk5qT5OQ7s/NSNnyb1d9KqKvDCjfSm2GktRY/lsWjREE+VFcAk2PICxoE6fXmJF4TW 4bW+J76PFpLNi9KI4wBOBgm33n80czOQT6BxBfgwa9el2+KRCjF+U11N322KbMxr0Nsw hRs8rH4/zptkBlCklWBZpridqTEzqatCeF/cmCcXtTJGjf6UZF1VgBfokr99TG/sz30r hwOyX2dUNdqb8TXSEQyycpd9Sh2V9WHPTdvKaKjiRGTn5bEKJeNUasUQKqwM2BCELxmG YJNExiul3OazN37D7DJk/BcqkobncLx0JG4W4KZIKcTlw46IgR8qD5nVmJ02qVdx5MTz 8s7g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAU9YWfyemQc0cr1zoibJesORYP3l+4Csrp9iQgQQVKxN7+U9DAy rWTm5kboCsXnHnVIrgeK8VjdpWDXfbgfHuPM9LSUsH5GDd2c4PHGTswxR2JWWmYwhVaoUsU6wbo 1SsKmT2WRLVqgdA+3zdFUijs4x/HcJM2jJG5y6DAM/Zv1PQPp9XqMucqtC/hczCP5lg== X-Received: by 2002:a5d:5607:: with SMTP id l7mr41766102wrv.228.1560675526279; Sun, 16 Jun 2019 01:58:46 -0700 (PDT) X-Received: by 2002:a5d:5607:: with SMTP id l7mr41766049wrv.228.1560675525426; Sun, 16 Jun 2019 01:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560675525; cv=none; d=google.com; s=arc-20160816; b=QGgji84SD9lYttE0JVCL0lw++1APtNjgArkslrp1g7cXHWB4Ildji7F/qgA9aZ+deu uzkFtUoFbM50/b2pKUSm4DL3yNSWzWt0AKlVUFIIcG+kjbhzfJs7Q8YeuPEVa6ve0p9U uhyTiG/5E7zy2UADX7Orhi5XtT6JS+lFGLPF9g2u35gHUOAKCN2WdSvad5iPsWiMAjJL ftEnZloa5L7/D96L04vWfWURnwEEVdTn6QtofIU0zVny67Qg5X77P6lRKK8s/6Ifj4ny GoLX6+9HcTix42aKT6BZ9y2itOOZvSE1CjUrFhTIigse90W00LmXs7tSU5d81NpiCzkz 77Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=hjjZi7hVawe1O5sE3agHwwCxgHKG18ng7v/8qT0V/18=; b=eU/ZOWVI8ZKvgMQbgfs/BF6PFt7+PLs2Bf7QI+aPQKaLoELsRG84f3xdXA+VfZ95jG HTYATxYnFbG0yuchdJoN4jI0ObQXkzZFmlZUl5ttdXZESZULYoYEXv4FggvNH4LsuP19 s/BakEAek7pyHqDmktswOGopUUHm6KXZ9HXtSKCA1nTohXPigCa0J5JI//m3IJ66/RUT tTRiyu/IVW1dGB2jOdAYOq87YiquZTP0j7Jfid9QqInjOG9hErmTdklWgs5UeUBB1Rum 6/jYq+ouCzGqXBPQu8Ca2+LXF1jkLeTbh9HepYr0h6R8trny9nlI+M/1Vpjh3Y6a3yyq dFYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y9sor1776615wrs.31.2019.06.16.01.58.45 for (Google Transport Security); Sun, 16 Jun 2019 01:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oleksandr@redhat.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=oleksandr@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Google-Smtp-Source: APXvYqwgBJiVgM4KiEAb/iF54vFPB8O+3Ztpe60o0gwS8ulqjH0TmG0LsqfT6UfUPJQvqxzCje57FA== X-Received: by 2002:a5d:56c1:: with SMTP id m1mr56928115wrw.26.1560675525088; Sun, 16 Jun 2019 01:58:45 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id c4sm3173448wrb.68.2019.06.16.01.58.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 01:58:44 -0700 (PDT) From: Oleksandr Natalenko To: Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH NOTFORMERGE 5/5] mm/madvise: allow KSM hints for remote API Date: Sun, 16 Jun 2019 10:58:35 +0200 Message-Id: <20190616085835.953-6-oleksandr@redhat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190616085835.953-1-oleksandr@redhat.com> References: <20190616085835.953-1-oleksandr@redhat.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It all began with the fact that KSM works only on memory that is marked by madvise(). And the only way to get around that is to either: * use LD_PRELOAD; or * patch the kernel with something like UKSM or PKSM. (i skip ptrace can of worms here intentionally) To overcome this restriction, lets employ a new remote madvise API. This can be used by some small userspace helper daemon that will do auto-KSM job for us. I think of two major consumers of remote KSM hints: * hosts, that run containers, especially similar ones and especially in a trusted environment, sharing the same runtime like Node.js; * heavy applications, that can be run in multiple instances, not limited to opensource ones like Firefox, but also those that cannot be modified since they are binary-only and, maybe, statically linked. Speaking of statistics, more numbers can be found in the very first submission, that is related to this one [1]. For my current setup with two Firefox instances I get 100 to 200 MiB saved for the second instance depending on the amount of tabs. 1 FF instance with 15 tabs: $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc 410 2 FF instances, second one has 12 tabs (all the tabs are different): $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc 592 At the very moment I do not have specific numbers for containerised workload, but those should be comparable in case the containers share similar/same runtime. [1] https://lore.kernel.org/patchwork/patch/1012142/ Signed-off-by: Oleksandr Natalenko --- mm/madvise.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/madvise.c b/mm/madvise.c index 84f899b1b6da..e8f9c49794a3 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -991,6 +991,8 @@ process_madvise_behavior_valid(int behavior) switch (behavior) { case MADV_COLD: case MADV_PAGEOUT: + case MADV_MERGEABLE: + case MADV_UNMERGEABLE: return true; default: