Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp1121474oof; Tue, 25 Sep 2018 08:31:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60RPWDO/zFfTrc0J4GUBjnzGM/6uQJXIL7SOr9nk8hlLjTWn6lXRHWrCbBtvryfKFDbgjAB X-Received: by 2002:a63:fe49:: with SMTP id x9-v6mr1628323pgj.152.1537889499439; Tue, 25 Sep 2018 08:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537889499; cv=none; d=google.com; s=arc-20160816; b=kynHbDoRoUCzr+ku/NW7WVm8KZA1lqNiLS3FuS3RpSWNCQ8VhVjQDVqYNsUng6egQe 1KHKhsYQcEELqaeu52SDFH/5F1U1kwOtMUqlmOox7PfJbI7ezJjoEx3A9MedwzVJavcN DdkY4Z6Q4k6b1E5gdi3E2QFVXA71tbktCNB2ACHG0wGtYLXBDWvMW2x362UeommiR3bt QtU4VG/e4XPUqnXygInatkybaFEHJFnxcXxOavqykksyMoe1npyWpefAcxpBjRi8pLNH 41Ptzx90ZubgSAFV4f83IXObs42Ggq8XnZwXj6z9cevXl7gmpT01noRthRgAwSQbUf/j zJdw== 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=yx+TWsW8znoDIv8XUFdsnuKQ+EDLq5WTNhzmqjBSJuTZMICcLI9ffKPEujpR58VmiE of7mNi2M7CSgzNkdWzYakbG3z7DL4ps/Q2zkgWMdKplMvBO+W8/ZxXBb0kasfBgZkVlz bP/A1FKxWo1N6ohqPEpykGJqJsxlQeuf+zr2bFaAO5fpcrVMMTWiGSETtaKMT/5VAwgp XlBZyyrs7tnmVwQDCNwjtpvXHwHk85kd1eU4nczFifI+eu8ltYjBdxkwj5u2HU47HCZ3 PuHvGd4+hOolwRX6HO8lnbIVPCI/NAqzBwraf027JZUaVxR34BHQXROYF3xnuZFlFAKn 9CNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b="xiIjmt/e"; 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 l127-v6si2520266pfc.135.2018.09.25.08.31.24; Tue, 25 Sep 2018 08:31:39 -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="xiIjmt/e"; 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 S1729816AbeIYViZ (ORCPT + 99 others); Tue, 25 Sep 2018 17:38:25 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:36981 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729355AbeIYViY (ORCPT ); Tue, 25 Sep 2018 17:38:24 -0400 Received: by mail-qt1-f194.google.com with SMTP id n6-v6so13785600qtl.4 for ; Tue, 25 Sep 2018 08:30:22 -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=xiIjmt/eWUB4u3fWLkbXc4bB7hWrJjmm0MZsa1qEd8+bOOshROHuBckxZSLE9WOkbC 9zKp4ykcV/4h1kwVZP20aH6CxmRLsn58jroSPwDyXAsgjo+7GsH/62PBM3emKGgMKl/0 qJdqIhQn2OffxV0dpEsqgw8TyQwTJyXDv7Yv3w7G70CekvgpufDW8C6byBD+fNwsYA4A DRJBi5PieHXCYIfxhAvdvYbKvgIneJRXYt7vM8ZMjtC34i+Jh4XxftG9VtmFNrv4Us80 4uMNMv/RXjd7aBT+STiW8dQa80NdBOSb8sscF0GIcVME/BtNWK5Nhw/ScCv99l8AUu8p AstA== 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=RUAIXi9Um02qCZrFvrTdqSjmryjKGVlSf6uqsB+T800/JUNt0OIYrFWJ8cOWkdJOXI SnqtoBdjzMCY4NcSUuFETEh/PY0SUztehr+nduiD/vw6ih5kfVwoC06Jz0gyxGXV2CyB /KY/EAAoR8AXTTXw79klFFI6SxvAgrzl+K3Ma0Cw2HBziLKO4mPUAuFiHH+q1rqjZhsd jV+9X9bhYggX9AdghS6yuzrqS5VN3F+AEN3fSMSjQ54cQeYys/sSMG7cfvk9Qr2KqHcr 0E51XRygyCKG8EVbJ6U+p+kH5fuvSJ9FPaW+QvwnhX2eSHiDchqIMOOoR6b+5pPicNbC YmXQ== X-Gm-Message-State: ABuFfoglEyUJ9/VsxHNBa9EueiqwSyJE0y/B83X4aW/yBs1fgveDPyQa 1TT/7AaurToiaeFfcS0EdNju0g== X-Received: by 2002:a0c:f8ce:: with SMTP id h14-v6mr1158470qvo.201.1537889421997; Tue, 25 Sep 2018 08:30:21 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id u184-v6sm1468940qkc.87.2018.09.25.08.30.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Sep 2018 08:30:21 -0700 (PDT) From: Josef Bacik To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org, riel@redhat.com, hannes@cmpxchg.org, tj@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Johannes Weiner Subject: [PATCH 4/8] mm: drop mmap_sem for swap read IO submission Date: Tue, 25 Sep 2018 11:30:07 -0400 Message-Id: <20180925153011.15311-5-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180925153011.15311-1-josef@toxicpanda.com> References: <20180925153011.15311-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