Message ID | 20200212233946.246210-6-minchan@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=LM+d=4A=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1327A921 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 12 Feb 2020 23:40:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA5EE21734 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 12 Feb 2020 23:40:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FZrxKndd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA5EE21734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8F5726B04D3; Wed, 12 Feb 2020 18:40:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8A85D6B04D5; Wed, 12 Feb 2020 18:40:03 -0500 (EST) 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 6D1276B04D6; Wed, 12 Feb 2020 18:40:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 504586B04D3 for <linux-mm@kvack.org>; Wed, 12 Feb 2020 18:40:03 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 01752824805A for <linux-mm@kvack.org>; Wed, 12 Feb 2020 23:40:03 +0000 (UTC) X-FDA: 76483095486.27.dirt46_74c7db148872a X-Spam-Summary: 2,0,0,6d7a5714a18556af,d41d8cd98f00b204,minchan.kim@gmail.com,:akpm@linux-foundation.org:linux-kernel@vger.kernel.org::linux-api@vger.kernel.org:oleksandr@redhat.com:surenb@google.com:timmurray@google.com:dancol@google.com:sspatil@google.com:sonnyrao@google.com:bgeffon@google.com:mhocko@suse.com:hannes@cmpxchg.org:shakeelb@google.com:joaodias@google.com:joel@joelfernandes.org:alexander.h.duyck@linux.intel.com:minchan@kernel.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3871:4250:4321:5007:6119:6261:6653:6742:7576:7903:10004:10226:11026:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:13069:13311:13357:13894:14096:14181:14384:14394:14721:21080:21444:21451:21627:21990:30054:30070,0,RBL:209.85.215.195:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SP X-HE-Tag: dirt46_74c7db148872a X-Filterd-Recvd-Size: 4618 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf16.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Wed, 12 Feb 2020 23:40:02 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id w21so2023587pgl.9 for <linux-mm@kvack.org>; Wed, 12 Feb 2020 15:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZMr8LhEVC9oO5IOdT1EAti6B5+7g8NKkMYB8pLjiUts=; b=FZrxKnddlcDw5zyfExhzpFB7yNfAtSGotiVUgDx7kQeEtRk96KD2mjuJAwspjEWZEN 8KQGuw5rgbMTjblF/1hERi1coEcedKQRj0A3ZDpTh/rLPLJ01OSf3UbmgfW6utovZI3H qKbek4ZUVtEesWnc8Jz1oh3eReFVrokHuT8LrXYSlGbQs0tKXLnC7cKdOT9I8H90mNP/ 6LeqDCmJSqRfYdC0SBilvY0LlpVtSqLG7Oof/zDRge1nTZaZh3bSa2QLWuT7PpN2E/V8 MufG1jDdEtKBDxSNXo3mv7bob5OGe9IF3J0ofzL96vWBtLLs9Lykq6WoQHJCnrmHn7sj g+/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ZMr8LhEVC9oO5IOdT1EAti6B5+7g8NKkMYB8pLjiUts=; b=aznDoG/dN3SjTwwtkhnauDaTP+3fbaVzcmn8EV1MidEYkP9/lNoCGA4Wj+QthoIHAw VuwoqYjLZascnfz0kXKuxSJQP7g+biif6kZNW+ZL1ouyn1cQvUxdf+4ovQBxwU5SUev0 vPseiECpOC6IU5liUnjx7s8E80NuvWNiwg9AphDkg+SSb7rKZ7lzmW7iw54FtyQyj/fw mh+TthQYTOrrPL196S/GzuYqw7XIk9DKLA+9aapm595FH16RcyAU1KwqbhoQUZqRJgX9 euUB9AAkWGknZD0x8v/ddKACe24bELcAnORPTk9DX+l0Xbb8cY4zJGzeLenRpWmce8YM 6rCg== X-Gm-Message-State: APjAAAWumqOBgniOncYfHBnZ9xXrXSoFV+acFUBz8mtWNYQfY4rGrX78 GJaVuFupTJNm/Wo/sTq6RXo= X-Google-Smtp-Source: APXvYqyTYiXBm1zUHh7AFeoGz7OUaVklPnIUFSpjd2o7FpUwNPngIaBgYKUhERpn7MoMtdc1mZ47HA== X-Received: by 2002:a65:645a:: with SMTP id s26mr10828696pgv.135.1581550801457; Wed, 12 Feb 2020 15:40:01 -0800 (PST) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id k5sm296664pju.29.2020.02.12.15.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 15:40:00 -0800 (PST) From: Minchan Kim <minchan@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: LKML <linux-kernel@vger.kernel.org>, linux-mm <linux-mm@kvack.org>, linux-api@vger.kernel.org, oleksandr@redhat.com, Suren Baghdasaryan <surenb@google.com>, Tim Murray <timmurray@google.com>, Daniel Colascione <dancol@google.com>, Sandeep Patil <sspatil@google.com>, Sonny Rao <sonnyrao@google.com>, Brian Geffon <bgeffon@google.com>, Michal Hocko <mhocko@suse.com>, Johannes Weiner <hannes@cmpxchg.org>, Shakeel Butt <shakeelb@google.com>, John Dias <joaodias@google.com>, Joel Fernandes <joel@joelfernandes.org>, Alexander Duyck <alexander.h.duyck@linux.intel.com>, Minchan Kim <minchan@kernel.org> Subject: [PATCH v4 5/8] mm/madvise: employ mmget_still_valid for write lock Date: Wed, 12 Feb 2020 15:39:43 -0800 Message-Id: <20200212233946.246210-6-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.225.g125e21ebc7-goog In-Reply-To: <20200212233946.246210-1-minchan@kernel.org> References: <20200212233946.246210-1-minchan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
introduce memory hinting API for external process
|
expand
|
diff --git a/mm/madvise.c b/mm/madvise.c index 276b9d81c1dd..71f0ba199ae8 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1120,6 +1120,8 @@ int do_madvise(struct task_struct *task, unsigned long start, 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); } @@ -1170,6 +1172,7 @@ int do_madvise(struct task_struct *task, unsigned long start, } out: blk_finish_plug(&plug); +skip_mm: if (write) up_write(&mm->mmap_sem); else