Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1237488imm; Wed, 26 Sep 2018 14:10:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV61oDufCb6SKX4+esoNJq58pFuejLK0z2Ur5A1TvNiFYb711r71+UGp60JfR6U2gwJ2rFwHp X-Received: by 2002:a63:4716:: with SMTP id u22-v6mr7058277pga.95.1537996238676; Wed, 26 Sep 2018 14:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537996238; cv=none; d=google.com; s=arc-20160816; b=eKCzc1yBeNj2i6O2AaugPJVNRFmXrZNq24YMaO9Tqp0tjAXA1Z3hn6ar4Icfo2K2dX 72QR5VJe4H+vrB3eFFzTjWWAzuOVti97YDEJMViCIy/LQzzF3pERhtViKbEFy0AUXIPg kpFl2trM3IDO0WQcEmwIzJOSpNOBsJECsZm6O5J9fAokficS7NvBlakYZ9iFz+2pkDIw 0OrD8FPXtcp1jEPJ+i/zLneOzK5WdUBCT18BIncA/Hm2tXHJjNkV0TjCPgJ9Ji6LTMSC lSQCxEmxAvVMqmnza/ew39tSlaMCUXEAMOJJTynloABJfGdzmu2BhUaKe2is9OS7tvcv irpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=L4OEsFz3WUjgEGzu73gT/wwAqaCABq/L1QMv8mr7jYM=; b=urXbfEuUB/wQQAS5H4lBOHaHZHMeiwNQi4hIxvnNaC3uofi4UG/4q5k0pakCZAxbP6 N/q6a79tGe/VBpk1/93aM3C+Eh3JQ7oCQtSSXt0DDoCseL+4DhYi9O9b81ztyBcHnZUn rmrTavn3HU+5zOHq2NBmowDxf9v4IQHA8FMnxwa5FdLqQcxBJOOk0gEgBQQsV0YeHH/1 WWLg9gSuf5bbZ0zzyszYsARVtPgeXPxBnmJrzlkCN7zWOSmkMa5UYqLSekyTyMaOwDu0 O5pgGCIRYwL8bxwRTnkzsaFh3cHS6h/Ivx0hMFkexCarwpAy1PIM7iqZ/+z+yqUVYMji kTbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=KzuvBbua; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si78082pln.232.2018.09.26.14.10.24; Wed, 26 Sep 2018 14:10:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=KzuvBbua; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727258AbeI0DX6 (ORCPT + 99 others); Wed, 26 Sep 2018 23:23:58 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39615 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbeI0DX5 (ORCPT ); Wed, 26 Sep 2018 23:23:57 -0400 Received: by mail-qt1-f194.google.com with SMTP id c25-v6so493216qtp.6 for ; Wed, 26 Sep 2018 14:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L4OEsFz3WUjgEGzu73gT/wwAqaCABq/L1QMv8mr7jYM=; b=KzuvBbuaLur8lPktdpvFa9kCRzdghPnke7Nb7qsvyTs/r/mFVoWLTwlp7SbvK6dod8 h27MFYZuD9ST4VbzRwOEKAPER5XjWL9YfkQPGPGFFKJJ6eZmg02p6dUFJwEGkOo0Rp/o 2s+oI3lPekVrwV9EYh0RZoBwGzue0DgWZSj+x5BHKmtXeppLEZBHNBbQx5h4xFeThEDS Wmq33Kk99E24OGVVW9Sd2miTsmwdg2muGlBP6bfTZMxpMudzwt1BTKmf3v+h4Wh1UIML UqAzfJT2d+TRIzWYbwEfQxFoEoEYoAlW1oHwwHLIcspURIeynYfIPaJNnSCLoD45CrDD LZXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L4OEsFz3WUjgEGzu73gT/wwAqaCABq/L1QMv8mr7jYM=; b=I5XYPKeli7vzsEfVCZSbuakqB+n4TyXDqETU18QAwgeBIRM9mrAy9WsmVoYGq5lES9 3xTzzBXOViT5Kufr5OfUC0dk/EQUZOs6h82iRd0j3RuKIzam1Xa+uNzAKz48VD5j4kIK id3XvVCH+0vtspz+kOvYJFP+E6yddGYtSxzRwo3ybAnagoq0yYuB4AGxg3tGueBOoIY+ t4nrQmf3uMImord1aUb2nr5/vWGrcno4h84QwJVobaqJFX/c1lyRv95dZtLPHku4doOe AM10iecR/rDlTa83VoZFkpd5boSVMBIbNAsFj1MYLi4gYVuwnR9qaZhpprBw6tTc5L0q NOlQ== X-Gm-Message-State: ABuFfoiz/WCSbDNz5VA64BCQJlcDRRfMa93MHA0GgQgSaoenOtq3U+YH bIDbsz+TtIq8Ht5jtZ9+GgPoPw== X-Received: by 2002:a0c:f906:: with SMTP id v6-v6mr5822169qvn.86.1537996146591; Wed, 26 Sep 2018 14:09:06 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id n25-v6sm87327qkl.8.2018.09.26.14.09.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 14:09:05 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-kernel@vger.kernel.org, hannes@cmpxchg.org, tj@kernel.org, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, riel@redhat.com, linux-mm@kvack.org, linux-btrfs@vger.kernel.org Cc: Johannes Weiner Subject: [PATCH 4/9] mm: drop mmap_sem for swap read IO submission Date: Wed, 26 Sep 2018 17:08:51 -0400 Message-Id: <20180926210856.7895-5-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180926210856.7895-1-josef@toxicpanda.com> References: <20180926210856.7895-1-josef@toxicpanda.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Weiner We don't need to hold the mmap_sem while we're doing the IO, simply drop it and retry appropriately. Signed-off-by: Johannes Weiner Signed-off-by: Josef Bacik --- mm/page_io.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mm/page_io.c b/mm/page_io.c index aafd19ec1db4..bf21b56a964e 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -365,6 +365,20 @@ int swap_readpage(struct page *page, bool synchronous) goto out; } + /* + * XXX: + * + * Propagate mm->mmap_sem into this function. Then: + * + * get_file(sis->swap_file) + * up_read(mm->mmap_sem) + * submit io request + * fput + * + * After mmap_sem is dropped, sis is no longer valid. Go + * through swap_file->blah->bdev. + */ + if (sis->flags & SWP_FILE) { struct file *swap_file = sis->swap_file; struct address_space *mapping = swap_file->f_mapping; -- 2.14.3