From patchwork Tue Aug 9 22:00:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12939966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5B48C25B08 for ; Tue, 9 Aug 2022 22:01:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74AFC8E0006; Tue, 9 Aug 2022 18:01:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D5738E0001; Tue, 9 Aug 2022 18:01:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41AB18E0007; Tue, 9 Aug 2022 18:01:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 188FF8E0006 for ; Tue, 9 Aug 2022 18:01:11 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E0852121249 for ; Tue, 9 Aug 2022 22:01:10 +0000 (UTC) X-FDA: 79781425500.01.BCA25DB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 2DE11100166 for ; Tue, 9 Aug 2022 22:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660082467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KJCqPuuo957wqhSKd7LcKTP/opuSiey74Ok7HcmJ/F0=; b=NoLT7q6oCXqtVwFy7b8KU5j5J5Bf1jrwczrbWLOy0pO6ke3GjCeith3sxsgjjvtLzo0Aj0 NFlWsYyhkOxZ4zVchYaJk51A5V2TRRAd1YuWgjOqA7/gxAeQrDw84VWxzAaKH+UB2qZcly Gip6xEla+YxzhJIa5IVG0MvLOikhU44= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-NWgKkz39N42paqziDuhEXw-1; Tue, 09 Aug 2022 18:01:06 -0400 X-MC-Unique: NWgKkz39N42paqziDuhEXw-1 Received: by mail-qv1-f71.google.com with SMTP id f6-20020a0cc306000000b004768e692cddso6870199qvi.8 for ; Tue, 09 Aug 2022 15:01:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KJCqPuuo957wqhSKd7LcKTP/opuSiey74Ok7HcmJ/F0=; b=HzN1XlPeg2SJfidBsEH83S0G6w5njxcOAS9ZSUOIuSabs36ddA80tp5PUtL7cPUxGy 0iQgq8N5CDlCbPhxf0VHloci9xyI349Y4wxVHnjn5sKjP1+FWLy990sjXLePFGnS3+ZA VF16QzG6jPF6Ua/vIufqN1lhd4eW60dz/y1T0CVT0fXXFACF+/Uim4yKCnO1gye5Bo3W jEJ5iO79f4ZRn0NqdAgFcJpQueGpWujkM4oO9e4LMOAcePqdkLfymS6r8QvieLirs0VF ThdZwKhRN+TMaXh0qUWaqB//P7pWN6VJrUjEIs3NY1Hf7QyOrcINaxNvUp20l2whpBmh oLlg== X-Gm-Message-State: ACgBeo0pHK7Lj2DoZcMEKPrbARAn8HjU0RQ/DhAfuBxcxwLY/EybsrW3 zpqTcFxTPFHynFkSlTzHFkaYj2Xs0c7O77hm7XuNxA8zqOxjD4S3O1+IDGWAen7Hr60rWPfQBgp ge+K9UINKP0HR/U++/orXBhLkRV7RMXjRW5RLZs/Zbj5NpD+OVjSRVy46/2u7 X-Received: by 2002:a05:622a:100d:b0:31f:25e3:7a45 with SMTP id d13-20020a05622a100d00b0031f25e37a45mr21707236qte.365.1660082466048; Tue, 09 Aug 2022 15:01:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6NiOVfmdP51FutgyMM1ys4/L82L2FgMCUHx+9da7UIEtdC/XWDWNPnpXmCoiTlsJ6ASHYdnw== X-Received: by 2002:a05:622a:100d:b0:31f:25e3:7a45 with SMTP id d13-20020a05622a100d00b0031f25e37a45mr21707192qte.365.1660082465744; Tue, 09 Aug 2022 15:01:05 -0700 (PDT) Received: from localhost.localdomain (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id b16-20020a05622a021000b0031eddc83560sm10563383qtx.90.2022.08.09.15.01.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Aug 2022 15:01:05 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Minchan Kim , David Hildenbrand , Nadav Amit , Andrew Morton , Hugh Dickins , Vlastimil Babka , Andrea Arcangeli , Andi Kleen , Huang Ying , "Kirill A . Shutemov" Subject: [PATCH v3 2/7] mm/swap: Comment all the ifdef in swapops.h Date: Tue, 9 Aug 2022 18:00:55 -0400 Message-Id: <20220809220100.20033-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220809220100.20033-1-peterx@redhat.com> References: <20220809220100.20033-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NoLT7q6o; spf=pass (imf14.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660082470; a=rsa-sha256; cv=none; b=dYXqM+Cz8sBvFZXpGwdtW4kZtJZZG/+7aSXWgYwL06RdskATZfeaNMCo+779zEnDn1yK3U rGYSOr7s2KDUhW8b7dOIccwWx9v/ce3+4aKFwozVKjPBoIUfdQGbYAqFTKBVwZS+Z6So6L 1FbFmrPM9qYmZEk1DP650WOQl2xIgH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660082470; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KJCqPuuo957wqhSKd7LcKTP/opuSiey74Ok7HcmJ/F0=; b=KfpngE7VC64269/DLray0FM6yNlMQolqqIz4He7+yr02gi7DLQhlV8sFFhlVyBVR/HbOqe nQP9TEdI4tQMhPeYS5yXc+1T4zfHcbNU299zpsM9PyL90SGPvXEre1dl4azqwFIoXtgyqP 7VB6tILPNwcuP7hFZ2pT+8lUUbg25Rc= X-Stat-Signature: owgeekqrdoh5hrxzha88ji6mi6ji6tj3 X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2DE11100166 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NoLT7q6o; spf=pass (imf14.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1660082468-277239 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: swapops.h contains quite a few layers of ifdef, some of the "else" and "endif" doesn't get proper comment on the macro so it's hard to follow on what are they referring to. Add the comments. Suggested-by: Nadav Amit Signed-off-by: Peter Xu Reviewed-by: "Huang, Ying" --- include/linux/swapops.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/swapops.h b/include/linux/swapops.h index a3d435bf9f97..3a2901ff4f1e 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -247,8 +247,8 @@ extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, #ifdef CONFIG_HUGETLB_PAGE extern void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl); extern void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *pte); -#endif -#else +#endif /* CONFIG_HUGETLB_PAGE */ +#else /* CONFIG_MIGRATION */ static inline swp_entry_t make_readable_migration_entry(pgoff_t offset) { return swp_entry(0, 0); @@ -276,7 +276,7 @@ static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, #ifdef CONFIG_HUGETLB_PAGE static inline void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl) { } static inline void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *pte) { } -#endif +#endif /* CONFIG_HUGETLB_PAGE */ static inline int is_writable_migration_entry(swp_entry_t entry) { return 0; @@ -286,7 +286,7 @@ static inline int is_readable_migration_entry(swp_entry_t entry) return 0; } -#endif +#endif /* CONFIG_MIGRATION */ typedef unsigned long pte_marker; @@ -426,7 +426,7 @@ static inline int is_pmd_migration_entry(pmd_t pmd) { return is_swap_pmd(pmd) && is_migration_entry(pmd_to_swp_entry(pmd)); } -#else +#else /* CONFIG_ARCH_ENABLE_THP_MIGRATION */ static inline int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, struct page *page) { @@ -455,7 +455,7 @@ static inline int is_pmd_migration_entry(pmd_t pmd) { return 0; } -#endif +#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */ #ifdef CONFIG_MEMORY_FAILURE @@ -495,7 +495,7 @@ static inline void num_poisoned_pages_sub(long i) atomic_long_sub(i, &num_poisoned_pages); } -#else +#else /* CONFIG_MEMORY_FAILURE */ static inline swp_entry_t make_hwpoison_entry(struct page *page) { @@ -514,7 +514,7 @@ static inline void num_poisoned_pages_inc(void) static inline void num_poisoned_pages_sub(long i) { } -#endif +#endif /* CONFIG_MEMORY_FAILURE */ static inline int non_swap_entry(swp_entry_t entry) {