Message ID | 20200110213433.94739-4-minchan@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=elf6=27=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 3CAE1138D for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 10 Jan 2020 21:34:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 09EEE20848 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 10 Jan 2020 21:34:47 +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="CN5DkxBO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09EEE20848 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 71A808E0008; Fri, 10 Jan 2020 16:34:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 67D868E0001; Fri, 10 Jan 2020 16:34:45 -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 4A7218E0008; Fri, 10 Jan 2020 16:34:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 333CF8E0001 for <linux-mm@kvack.org>; Fri, 10 Jan 2020 16:34:45 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id DE2C5180AD811 for <linux-mm@kvack.org>; Fri, 10 Jan 2020 21:34:44 +0000 (UTC) X-FDA: 76363029288.04.bells84_c4c25046592f X-Spam-Summary: 2,0,0,57d214d84806c4e0,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: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: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.210.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24 ,LUA_SUM X-HE-Tag: bells84_c4c25046592f X-Filterd-Recvd-Size: 4549 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf50.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 10 Jan 2020 21:34:44 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id 195so1723094pfw.11 for <linux-mm@kvack.org>; Fri, 10 Jan 2020 13:34:44 -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=89Kh03xU7w1BbnZNyOorUIvmlI1tvq4/L3B5YcvwpqQ=; b=CN5DkxBOYcoZgoiH2Jg3EQwKATglnYi/wVLvJpLQHlzdJyFu/8fl8QjLSRY+E089Dv UBb1RvbJ7SWnmO8UDEIvtF3nSSLvDitBa+gvxVGttXpwCiS7xqI5oDIBRq/7tzUJLVGa bbTykYCi84W6ZUPr9/Otr5aamOfMUSZeM0mKCemPrw0+VLcm/ifCMQVmN54xb4XWUQ3Q qgMB+KMUKiYOnyXMzJnOdXcwW6JSms1sYN3mcPyf9Q1p5NQIg8PbUfrddxPob5rSSht2 WsOgwCVDy/Sv604e3Sl3xT3h+USBKk1WH2Y9+mR76qdS/AYSjae1hGw51oxcFZeYOBAt PICw== 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=89Kh03xU7w1BbnZNyOorUIvmlI1tvq4/L3B5YcvwpqQ=; b=t4L+XBX//XkxoqLFvIxSh4Q6/dj1U94A/qfCpSu36NJtsH5md78P1nG3WFILE2TMS+ 63/MVeVmCZG4XXF9CVRAmjpzB+tUDNcX/FUaslB1fjMjACbfK8E2o6l8ZBFdrN1qpsHr mlOoDsAeaqjtZ8jem4pAgmW1OwIODDdytv8PVnPoQuZOJ0Qq5ep06EDG3F7TQ1GlZSSO OT97sW8MJcTIJ5ghxuz+YjUFOZZafZ6Cy7i3pQlrEoEH1GNWpoaI69qBjTl1WU13SHPc YEU8s0ly3r5P/Q3txl3Gj2rDzO6vc8neWT494+dOk/+C0h7kJqUaLHnt4zys7anlbRpP A9cw== X-Gm-Message-State: APjAAAWf7Qw79TFT2fiofwZVGmU5lvUAFL4pgY2ibyDWnurEA4y/HcYs rbSnOoqipu3Ytv9rLyBSjWk= X-Google-Smtp-Source: APXvYqz7Q5MwkbpSHvKG6GzBJj5sOFfZsoHRNrjc1+Ap4AxBr5ADxxl2rO10KMu4ykwTZzwAJ7B1cw== X-Received: by 2002:a63:5920:: with SMTP id n32mr6683623pgb.443.1578692083372; Fri, 10 Jan 2020 13:34:43 -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 t137sm3692307pgb.40.2020.01.10.13.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 13:34:42 -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>, Minchan Kim <minchan@kernel.org> Subject: [PATCH 3/4] mm/madvise: employ mmget_still_valid for write lock Date: Fri, 10 Jan 2020 13:34:32 -0800 Message-Id: <20200110213433.94739-4-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.rc1.283.g88dfdc4193-goog In-Reply-To: <20200110213433.94739-1-minchan@kernel.org> References: <20200110213433.94739-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 e15dfb4df7bf..eb42b2b7f49b 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1059,6 +1059,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); } @@ -1109,6 +1111,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