Message ID | 20200116235953.163318-4-minchan@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=Pa3/=3G=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 A9A3F921 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 17 Jan 2020 00:00:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76362207E0 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 17 Jan 2020 00:00:15 +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="WJ92vaxE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76362207E0 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 AF9BB6B0007; Thu, 16 Jan 2020 19:00:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AAD4E6B0008; Thu, 16 Jan 2020 19:00:11 -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 974456B000A; Thu, 16 Jan 2020 19:00:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 8044B6B0007 for <linux-mm@kvack.org>; Thu, 16 Jan 2020 19:00:11 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 1188045CD for <linux-mm@kvack.org>; Fri, 17 Jan 2020 00:00:11 +0000 (UTC) X-FDA: 76385168622.14.beast68_1ea21eb17bc39 X-Spam-Summary: 2,0,0,e004c5fbaddfd616,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:ktkhai@virtuozzo.com:christian.brauner@ubuntu.com:sjpark@amazon.de:minchan@kernel.org:minchan@google.com,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.193:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netche ck:none, X-HE-Tag: beast68_1ea21eb17bc39 X-Filterd-Recvd-Size: 4663 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf10.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 17 Jan 2020 00:00:10 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id k3so10741993pgc.3 for <linux-mm@kvack.org>; Thu, 16 Jan 2020 16:00:10 -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=H1DNUZeta8kOxobeAib3DAPo7bHpJ+/lYiSVOVvzyGQ=; b=WJ92vaxECeagQOoGBDEDdM7YktShjAd3nesXf6/7YuFwM6gwIC9ZFcYHpMBycQy7jx OUb6ZmuMxApgyI70xP3UPmBYhUswrWydKD2x2V87vtcno4GaGsDWfeYRUlk/N5fgDIbI Zpm4x36fZlEVZWG12IdYFGTH0OLNz/OfQ3SWxDGyROi46G2CMokgMt4TVXtHGhSu2a7y lPGaSXSNCIfzqj1NK3+8UKA2pg00tSRYeWh7byCutkbIiE46Q6cY6a3euF71NbDf4DSQ d5h/tvIqpEZB647toINcAtPUuBQBxyxOhSKaowiq4YWzqkb1MEwB/HMFrjPvrazpX9FZ q7Qg== 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=H1DNUZeta8kOxobeAib3DAPo7bHpJ+/lYiSVOVvzyGQ=; b=TLAXZr+A05/+mzLOXWLppyfgNVJhJtdBSzGgXxJILOGlcmSuzzVVRlyxrFG+/Mq+be nYJcFLZF0cxBotsERyix5QAzU2ceAghLwqogUi8OOpweKq2ALWooyXZ5jnpn5r3IIsfi R2xwgRkXQm/iJywi+m55gVonHHOZXPfNHxunvWCin1dWYE2f7kgeAWmqA1/iUTpA+dt1 LFQdm51AaN5PMiCiHbj7qlz4CTohj7Gos2a2TqSpq+We/wCv+3I/1WPsMbgYRy7SFBSz CgWBB/m9X/RlRuJO9nKwZJvKqbC/QrA/C33qDM1b5FC0h68bgtxQOuIwZO+YegC+3BnC tf4w== X-Gm-Message-State: APjAAAXL1a/jpFVZTlQAGF+62Hd+x3deJ4VHSDkLJHQmPSOTgQeMBaYv G8rBRDtmqBiTp6dxyoGn6zk= X-Google-Smtp-Source: APXvYqyPinp8CvGNRE9v8A54LMeUYeFi996WEC2tsK78EEm8vsNaHuPQ0nYWHFxnY7x2K4aNEz4mKQ== X-Received: by 2002:a63:1447:: with SMTP id 7mr41679802pgu.22.1579219209212; Thu, 16 Jan 2020 16:00:09 -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 z4sm26584885pfn.42.2020.01.16.16.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 16:00:07 -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>, ktkhai@virtuozzo.com, christian.brauner@ubuntu.com, sjpark@amazon.de, Minchan Kim <minchan@kernel.org>, Minchan Kim <minchan@google.com> Subject: [PATCH v2 3/5] mm/madvise: employ mmget_still_valid for write lock Date: Thu, 16 Jan 2020 15:59:51 -0800 Message-Id: <20200116235953.163318-4-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.rc1.283.g88dfdc4193-goog In-Reply-To: <20200116235953.163318-1-minchan@kernel.org> References: <20200116235953.163318-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 59b5cc99ef61..84cffd0900f1 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