From patchwork Thu Jul 19 08:48:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 10533883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97019600F4 for ; Thu, 19 Jul 2018 08:48:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86467295DB for ; Thu, 19 Jul 2018 08:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79E7A295E1; Thu, 19 Jul 2018 08:48:56 +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 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 1365A295DB for ; Thu, 19 Jul 2018 08:48:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 738B56B0272; Thu, 19 Jul 2018 04:48:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 70F396B0273; Thu, 19 Jul 2018 04:48:54 -0400 (EDT) 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 624A16B0274; Thu, 19 Jul 2018 04:48:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 2378B6B0272 for ; Thu, 19 Jul 2018 04:48:54 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id k9-v6so3749323pff.5 for ; Thu, 19 Jul 2018 01:48:54 -0700 (PDT) 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=cerqxQ56wQMXVrHNtXUfpfFw9TdEQ3y9jDoSjtRXPZs=; b=MwuR2N2v8ETbscUP03bf6nwhBzG/rxKV2mU003tATyGVeDH7BaXQhfHjG5xN3YpVUk 1wEVQ2bwRWzdpLn2H+reqC6F4J76X1B2TuviWsRwWz1sag5QDTpunVrxkyvlRd6jDctL jKKgiJDqPhH1VcOfx0YsCHExDseTvj3Ac1bwKZsXYqBHQdQNcIImQQQb+dQ1nHjw+q4y Dr+LSX2zcG3GAi8n5dAOS1r3yKCGNl2+mNK7kIaI27gFcMYlt8ZMOxE+gRyhuKy+AMIP ppOrEkg9r9x8ycsoOzUExwsL6L349H4MK1zBdBNQABPwzCJoSG8qgd63h9bb3voj+N9A 8FOg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AOUpUlEL1wE/xSswU/eGW2IeAaYH1vcc7PekUJIDI3X54mn4sB5th7qN vsKFwemd+lFynOgQJ+oO1C1mgSmUcGmCPspT9UD4/iIzaIp6zC+Wl9LywBj/vKen5F39rtpO6lv BTUX/R6Hc8DSUt4WzEofOKMPQzuqwrd6zOMjY+DF6bPibrPPfF5upeLF37EK6uo8pTw== X-Received: by 2002:a17:902:e201:: with SMTP id ce1-v6mr9082126plb.136.1531990133841; Thu, 19 Jul 2018 01:48:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfPNGAHQO7YW1AxpruPCAvhmzx/WcPMKUIFJdvK4++TbwFi20x99lEHeYEcNc1U9hNyDxn4 X-Received: by 2002:a17:902:e201:: with SMTP id ce1-v6mr9082085plb.136.1531990133076; Thu, 19 Jul 2018 01:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531990133; cv=none; d=google.com; s=arc-20160816; b=0qv0PISBxlpL2+imkA5HvB75QsgrUjB+wxPrcrUWsTIVJohPZDxFIBTRU8IUgAEJm6 6cy+dsEcY1iJrJA+rspAMJES+uSyRkGAycfjPP9zUGD/QzKWYUJrY6GaiYs3FOddh2XK zRODdsF9tpGjc/gQl0YbnLFZmeY83utr8mBw0LhTffqFZyWKIJ6elEUVtDsvdDUcrt6o s3Owm0igcCEXRy3K6x6iDwHHey0acsqlQ0k2uwcsK3TYjc6o1KSBjF9UluTN+wziuLgM Kb8vo7deQs5jFD+powt4e+lw8YeGgS4czrS1DAM5Dn3kvFTP4Sp0FbLrI+hQ0Qr1RB42 4wCg== 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 :arc-authentication-results; bh=cerqxQ56wQMXVrHNtXUfpfFw9TdEQ3y9jDoSjtRXPZs=; b=O0pV8W92so7SM0Haa3mBPGwm7I2CKgHqX54bFRFymdkOA5dGOelaFOUSZpRPdNSEcl YRvb5yVs6f6l72h5hWT+FqlE76g1rhXAdYQ/tuyOmt7zwkhDdkLVAmT47jQiVHt64zos 3jho0MvzPX9vNrM6sa9dKDcg9EFJAGG6MMqSuWEQjuVv1fvqMhYQp32P8J6uHoMiD4f/ trh7Xcwkqgo7UVBgOzNBJkwELiWtV8l7+yvAZNfrFLelTZES1mExEBa15x/+FAbPn8mR UjDb5x/qLUXF/DvaEDNDsIeHJ9J0H+tXs8MwCh17JSrGUQs0I1INdZWdfkAw1yhYGd38 xWjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga07.intel.com (mga07.intel.com. [134.134.136.100]) by mx.google.com with ESMTPS id x18-v6si4948122pll.193.2018.07.19.01.48.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 01:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) client-ip=134.134.136.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 01:48:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,374,1526367600"; d="scan'208";a="76038263" Received: from yhuang6-ux31a.sh.intel.com ([10.239.195.246]) by orsmga002.jf.intel.com with ESMTP; 19 Jul 2018 01:48:50 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Michal Hocko , Johannes Weiner , Shaohua Li , Hugh Dickins , Minchan Kim , Rik van Riel , Dan Williams , Dave Hansen , Daniel Jordan Subject: [PATCH v3 1/8] swap: Add comments to lock_cluster_or_swap_info() Date: Thu, 19 Jul 2018 16:48:35 +0800 Message-Id: <20180719084842.11385-2-ying.huang@intel.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180719084842.11385-1-ying.huang@intel.com> References: <20180719084842.11385-1-ying.huang@intel.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 To improve the code readability. Signed-off-by: "Huang, Ying" Suggested-by: Dave Hansen Reviewed-by: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index d8fddfb000ec..29da44411734 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -297,13 +297,19 @@ static inline void unlock_cluster(struct swap_cluster_info *ci) spin_unlock(&ci->lock); } +/* + * Determine the locking method in use for this device. Return + * swap_cluster_info if SSD-style cluster-based locking is in place. + */ static inline struct swap_cluster_info *lock_cluster_or_swap_info( struct swap_info_struct *si, unsigned long offset) { struct swap_cluster_info *ci; + /* Try to use fine-grained SSD-style locking if available: */ ci = lock_cluster(si, offset); + /* Otherwise, fall back to traditional, coarse locking: */ if (!ci) spin_lock(&si->lock);