From patchwork Thu Jan 3 19:27:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10747777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E1A413B5 for ; Thu, 3 Jan 2019 19:29:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E7E32888C for ; Thu, 3 Jan 2019 19:29:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32E202888D; Thu, 3 Jan 2019 19:29:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BACA0288BA for ; Thu, 3 Jan 2019 19:29:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECBD38E00A4; Thu, 3 Jan 2019 14:29:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E7B9C8E0002; Thu, 3 Jan 2019 14:29:53 -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 D6D388E00A4; Thu, 3 Jan 2019 14:29:53 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 95D9C8E0002 for ; Thu, 3 Jan 2019 14:29:53 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id 82so35459991pfs.20 for ; Thu, 03 Jan 2019 11:29:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=CwH9R0kAYl0ul+9aY6aGYaEnaKcBsn+4x5F7VRo5cag=; b=uIh2dzGs4cX2ldZAGuWL2kFy82S9lnyyGbANNTGMBs6EBLFG/W1wjvcM9iqPvvyvsO AZlLN+B5gjyq4HJF+tmw8sGEoxptAMfDvoxjUKEgujJGFGrHP7XXIRtlgRazh/fFhroF t9wNW3w14KZHkFv9OrfqNUfAnMk81eH4f4EVZkb1/74mT75T24Sv4RHkGHENuvf7qRVB 1pLt0qTQeXiZXIXzLGVp4hXLjFy02XeRc4DXSyyKRfnJ75JTQRVBqBc1FndC/CjVGhyt 1V1E8CliW62m+PysV3plkH6543J6bGGkGyygQ4c9k/ST/qCZIgc8Z7weD2Bmggqn83Y4 9D4Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: AJcUukcKF/+fKYu/UbUC+N85eZ+1jWkwqiOMc/Wqq92a8k9u03Cgf4Cc sbH0FTzXTtuY6bzW2Nn4Qd9BPBK7Xs13ilyJ2u/RtbsRCqK/d2chnThmHXs5QD/iPuLlVvUoAyO IAG/vsnqjuL/VN5i24AAkBh5NEQ8zHhwshQQaYyx/PHQd+rblcjnvJcwoMq+V8nrBvg== X-Received: by 2002:a17:902:5588:: with SMTP id g8mr48370090pli.22.1546543793255; Thu, 03 Jan 2019 11:29:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Yu0ePGal48EMnZR9EJSbEGA3Z8pZpbAg16axMI3jXdy9pjqPuwqCJuTeZ5vqowQ5Ql2CC X-Received: by 2002:a17:902:5588:: with SMTP id g8mr48370059pli.22.1546543792612; Thu, 03 Jan 2019 11:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546543792; cv=none; d=google.com; s=arc-20160816; b=zRg4Zzq5S8RzZXgzcOOVGiItehM1AeIXrRm8ctxpzsaBEoMd0za8Ku8kjZSco2uzbO RLr7NNaDSpjoUKYKI9ZFjujjfam+6KnXwolGCXMilua8qr6S1pPxU8wClK4P385a3K3X H+cNsvcHASUPYnz+YuV+esR66qI2hnLtW+OCzlri8JlfaO8b+rzQz9HNjeMuN4hMmyAF 92g/WzsDQLHXKqXtKVYTnPjsd5CTUWsJtxoByncs62Pv1f/FB2pqmQxA4m50TEVFb3o3 f9yYda47OGx+TXh0qgUO4axZ3sdzdGKrb+Ma+28l7T6v4sKq2ZioW/1YChyrrXg6vqgk cKbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=CwH9R0kAYl0ul+9aY6aGYaEnaKcBsn+4x5F7VRo5cag=; b=M+BQYaOdC/Pk5HmwEgHUxUJDamD18YGEErUCFZs+QHzvI/I7AmO983Ovs+1PtVQ+aj LJuYna1gjIHcYKBZ8RzVJuVnJxhO0e2gWNI+hSwmWvVEQQ3jSzazuiSExQebu2Sttxkr 4TO814qQ3XpmwVy/GQdWMvvKx3mCvey7QafxxHyjD+L1oDoKGuSynqSb7rxCe4riVPQB xjZLEOeDqsdjU0XwYljmiWA3xVVvj2lw1nIoUk1H1rrm4u5IAyKtgflQBm/Y2XVEw+U9 6d8qWTC6A2H20Od0/XwloSE0VZTrl+wOl7JAlwZviWs7NOI1Od3ybGsIlTyCPycCTRAK J7Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com. [115.124.30.133]) by mx.google.com with ESMTPS id o6si3864554plh.23.2019.01.03.11.29.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 11:29:52 -0800 (PST) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 as permitted sender) client-ip=115.124.30.133; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R701e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0THTEqVm_1546543673; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0THTEqVm_1546543673) by smtp.aliyun-inc.com(127.0.0.1); Fri, 04 Jan 2019 03:28:01 +0800 From: Yang Shi To: ying.huang@intel.com, tim.c.chen@intel.com, minchan@kernel.org, daniel.m.jordan@oracle.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [v5 PATCH 2/2] mm: swap: add comment for swap_vma_readahead Date: Fri, 4 Jan 2019 03:27:53 +0800 Message-Id: <1546543673-108536-2-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1546543673-108536-1-git-send-email-yang.shi@linux.alibaba.com> References: <1546543673-108536-1-git-send-email-yang.shi@linux.alibaba.com> 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: X-Virus-Scanned: ClamAV using ClamSMTP swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi Reviewed-by: "Huang, Ying" --- v5: Fixed the comments per Ying Huang mm/swap_state.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index 78d500e..c8730d7 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -523,7 +523,7 @@ static unsigned long swapin_nr_pages(unsigned long offset) * This has been extended to use the NUMA policies from the mm triggering * the readahead. * - * Caller must hold down_read on the vma->vm_mm if vmf->vma is not NULL. + * Caller must hold read mmap_sem if vmf->vma is not NULL. */ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_fault *vmf) @@ -698,6 +698,20 @@ static void swap_ra_info(struct vm_fault *vmf, pte_unmap(orig_pte); } +/** + * swap_vma_readahead - swap in pages in hope we need them soon + * @entry: swap entry of this memory + * @gfp_mask: memory allocation flags + * @vmf: fault information + * + * Returns the struct page for entry and addr, after queueing swapin. + * + * Primitive swap readahead code. We simply read in a few pages whoes + * virtual addresses are around the fault address in the same vma. + * + * Caller must hold read mmap_sem if vmf->vma is not NULL. + * + */ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, struct vm_fault *vmf) {