Message ID | 20200214170520.160271-7-minchan@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=bxHB=4C=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 AE3D5109A for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 14 Feb 2020 17:06:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7ABD920637 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 14 Feb 2020 17:06:36 +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="RQvOq32m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ABD920637 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 507026B0651; Fri, 14 Feb 2020 12:06:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B8CE6B0653; Fri, 14 Feb 2020 12:06:35 -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 3A7A26B0654; Fri, 14 Feb 2020 12:06:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 1E0936B0651 for <linux-mm@kvack.org>; Fri, 14 Feb 2020 12:06:35 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B3CE28248076 for <linux-mm@kvack.org>; Fri, 14 Feb 2020 17:06:34 +0000 (UTC) X-FDA: 76489361508.07.coach53_90aa5d2a96a48 X-Spam-Summary: 2,0,0,54fe5b7343bb71f4,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:sj38.park@gmail.com:alexander.h.duyck@linux.intel.com:jannh@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: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.214.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0. 5,Netche X-HE-Tag: coach53_90aa5d2a96a48 X-Filterd-Recvd-Size: 4661 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf09.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 14 Feb 2020 17:06:33 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id c23so3951590plz.4 for <linux-mm@kvack.org>; Fri, 14 Feb 2020 09:06:33 -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=V7GUkh8wE1dRQiutiAZwQygV0oqWtMLGFWC+ZDS/JnU=; b=RQvOq32m45tdZVuQ4eP1UET1YZUzdiMgqS7sSPeokFVt7jEldPUoBqPTKGstnRngbF 75+1ncGimpxQlYmLre/iK7NDvLq5nH9Hi2GOxUwGhbRCZJZt2puGtJKk1yDtaNxdvTOa H/HYX/Zmw9vTr3fPSoY7uBY66RtNlMV/AMAWXeRe+em474RVFHaMWlLU35ynOr5o0Aln 3w27QgjvOu2G2AsRfDdNSepSUB0fIO/aFIzpGmYcuoM5LFW+01oXGF0iKP2e7kzay49e Mv30kROuXKTJkKiBAtSpcvfYw77pEgG193ErM30jobYpwJHikPO41vYt6EZFzgMttboN PzsA== 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=V7GUkh8wE1dRQiutiAZwQygV0oqWtMLGFWC+ZDS/JnU=; b=os7h+5+QdrtRNIgumBK3ys1UJzn8N9Ca1bgpomZWcxpdNAmJhXLeOPKdvAJThDYoIe Jz/oflsAyOYf80yP6XExjiywT0kkpDJrCt5zfmD8vQJQwdUVB9Teodx3lxQGONQinSzO feQCNhFmlE4qjSElDdynUko4JkivZDfWx1FYhR0X7oSRlt869fjkpPzvMZYYO0d+Dd+z 3/yFgrKUeioOTn42zsc05D4UWtYBP/pqGHNGp+W2G4X4tk/x2eg0e0+8dB4ZmYZpMYKM cob3PuLNCNa/J7fmiG3heTQxJpfpsEPRBx6lPja0FHquIniv7paqbQIlBjRJc9L0Kl0F Zb4Q== X-Gm-Message-State: APjAAAV9qTFl8hMHDmHnzY54BPSipyMnFLEL4kLtnzQqDuGecizgLUSt arYsIZMooRAJmeGWUaBHo80= X-Google-Smtp-Source: APXvYqxGn47fJ2zoDaJU+qvDPEHLfhiapXpwP4YiNrmS4xOrwHPdDO5MUL/VY69qyCv30aJDRferSg== X-Received: by 2002:a17:90b:46cf:: with SMTP id jx15mr4967429pjb.2.1581699993075; Fri, 14 Feb 2020 09:06:33 -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 a13sm7662924pfg.65.2020.02.14.09.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 09:06:30 -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>, sj38.park@gmail.com, alexander.h.duyck@linux.intel.com, Jann Horn <jannh@google.com>, Minchan Kim <minchan@kernel.org> Subject: [PATCH v5 6/7] mm/madvise: employ mmget_still_valid for write lock Date: Fri, 14 Feb 2020 09:05:19 -0800 Message-Id: <20200214170520.160271-7-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog In-Reply-To: <20200214170520.160271-1-minchan@kernel.org> References: <20200214170520.160271-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 bbbfea93396a..762a68205e65 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1117,6 +1117,8 @@ int do_madvise(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); } @@ -1167,6 +1169,7 @@ int do_madvise(struct task_struct *task, struct mm_struct *mm, } out: blk_finish_plug(&plug); +skip_mm: if (write) up_write(&mm->mmap_sem); else