From patchwork Thu Jul 12 23:36:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 10522407 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 A9DC9605DC for ; Thu, 12 Jul 2018 23:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C03829441 for ; Thu, 12 Jul 2018 23:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9075E29485; Thu, 12 Jul 2018 23:36:50 +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=unavailable 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 158E429448 for ; Thu, 12 Jul 2018 23:36:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 995A76B000A; Thu, 12 Jul 2018 19:36:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 947066B000C; Thu, 12 Jul 2018 19:36:48 -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 795C66B000D; Thu, 12 Jul 2018 19:36:48 -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 323546B000C for ; Thu, 12 Jul 2018 19:36:48 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id v25-v6so11272766pfm.11 for ; Thu, 12 Jul 2018 16:36:48 -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=CkFuqqWsJx1+DIFOx3mnQ+bbr5sCbY+/P00bothYo0Y=; b=nXw+2HDbiUh+snfuHXJkbSE6gtrPWzxWZfNerebN80DJOvIxroij/K9si5ca5fvnFs 4I8CscmQ/5Eve5XeRV8LxOSKBNRXkunFGdBb+8ovBSrA4Vnb5Q+Loj4GzRm92z9QjTKz IDjGks8XO2F9eDs9N1maXwMVXzAyyMAo4T6TcCpyvrrp6HC3ubdSgbw7mFSFTdZnZV/+ OgXFBJGdUo3ibG24Lmh9GblCWVqSRiWTxScGPfo4KoFjehYVyU/PgbB4k8HD8eAZ3hy3 cSzAKHyrEg4CMYwDgqVMvMG7ivxlEx0cJQjSl9uKMriG0QLHIkz8iHN0ukb3eGHsvCSF DKCw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.88 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: AOUpUlEPx0jSdF7pceQ3bUcHAciwGP+l/6W5vzJxjJy+kVat+/osFx32 DfaQ6wsjdNB+E8Sw8tBDclBQQXOIozSA4M3AZPnThX/ULHNQ5HqLu3E0YCnozYtsKxLmmXHCDsF AqT97HvB8qSnVCDVhDQwKrp89COcrLZi75/bFVcPsBae2ebzBmKSng9rx5+1/wStxiQ== X-Received: by 2002:a62:3a9d:: with SMTP id v29-v6mr4446695pfj.215.1531438607893; Thu, 12 Jul 2018 16:36:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzNK9rxdh1xSMdKBPjRSpnzCPYl1w71lC5YsqrwyePb54Cx1xw2a09zl7cEyNF9LpQhPxu X-Received: by 2002:a62:3a9d:: with SMTP id v29-v6mr4446666pfj.215.1531438607200; Thu, 12 Jul 2018 16:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531438607; cv=none; d=google.com; s=arc-20160816; b=mZcr2/DXBLz+DhcnqnsBH5mtT81C262nZzmIOgNt+wydQAtm7qh8V3mk+HwZc4cFoO USC1Ko/kbNZkierJW8cvc0zGuWP4DxrYdHq1Vju+b/5dX2wwsy8gGYCTtsnWvv43il4z OxBzfVvPc51VFAYBeLVFovVH2PAo/JPzUlUBq58MBporE1JD4GtvzGB60gNZ2HojnfJB bA9zakMuHoBd+Ex8aYV/n8y8inOajDt8LH4LZ6eOzip7L1N7Yp/KlDAOl+ZiYKNNfVqm iT4US1xxEdzm7viafvl4t1XvjtPuWsXSKYhZPs7vo3o2CPUk8OwRhC0xLTVWn25INrLN f8AA== 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=CkFuqqWsJx1+DIFOx3mnQ+bbr5sCbY+/P00bothYo0Y=; b=JlS8UDUEd5ujvBPGK01EL8uR3v5nw9Yh5EgO6z878gJKfqN7xGvaEX9T0ogDkaDEdt DQFTaI5Uv1B3J/oAGgCwKZP9/Awf73RRDwIoh/vc0yjPwfRUh25aQIiXBDlPzFmZvRWr 3fgWErxeh+IDVR7nrOLCYBrwuXiQ2ayTtq57Gy4HPSGQ3CvMBt0zNphQ0GcDD/Cn7x/4 mP+VP0ts0priWtcWUB90rWLArqOZoYeXt1gTTl5Cc5LVtm5J9IkbRaZZ+UgzapYjjD9t vaS617cmJUBcNWf7VXT0NQkDyRMJoSiDy/1akuLNPgbUDuVYnHPYxDsfEg72EWS8G0S0 JVOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga01.intel.com (mga01.intel.com. [192.55.52.88]) by mx.google.com with ESMTPS id c15-v6si21063744pgw.550.2018.07.12.16.36.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 16:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) client-ip=192.55.52.88; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.88 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 orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2018 16:36:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,345,1526367600"; d="scan'208";a="57272231" Received: from yongjuns-mobl2.ccr.corp.intel.com (HELO yhuang6-ux31a.ccr.corp.intel.com) ([10.254.213.67]) by orsmga006.jf.intel.com with ESMTP; 12 Jul 2018 16:36:44 -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 , Daniel Jordan , Dan Williams , Dave Hansen Subject: [PATCH 1/6] swap: Add comments to lock_cluster_or_swap_info() Date: Fri, 13 Jul 2018 07:36:31 +0800 Message-Id: <20180712233636.20629-2-ying.huang@intel.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180712233636.20629-1-ying.huang@intel.com> References: <20180712233636.20629-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 From: Huang Ying To improve the code readability. Signed-off-by: "Huang, Ying" Suggested-by: Dave Hansen Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Daniel Jordan Cc: Dan Williams --- mm/swapfile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index d8fddfb000ec..e31aa601d9c0 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -297,6 +297,12 @@ static inline void unlock_cluster(struct swap_cluster_info *ci) spin_unlock(&ci->lock); } +/* + * At most times, fine grained cluster lock is sufficient to protect + * the operations on sis->swap_map. No need to acquire gross grained + * sis->lock. But cluster and cluster lock isn't available for HDD, + * so sis->lock will be instead for them. + */ static inline struct swap_cluster_info *lock_cluster_or_swap_info( struct swap_info_struct *si, unsigned long offset)