From patchwork Thu Aug 11 16:13:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12941583 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 B4D05C25B06 for ; Thu, 11 Aug 2022 16:13:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CC1F8E0005; Thu, 11 Aug 2022 12:13:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 555508E0002; Thu, 11 Aug 2022 12:13:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CEAC8E0005; Thu, 11 Aug 2022 12:13:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1BEF48E0002 for ; Thu, 11 Aug 2022 12:13:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EC150C013D for ; Thu, 11 Aug 2022 16:13:40 +0000 (UTC) X-FDA: 79787807400.25.CFA0686 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 6E3261C01B8 for ; Thu, 11 Aug 2022 16:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660234420; 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=m9J0o2gxjPkVRafIB7R87NmoXI0VU2ltkrT9Ru6AEjI=; b=KfxjeyuubahoXRX0vgxCbfl9Bl8gEB2OAPI4I9QFSe3BcczwfCvD+E9AyCcetTIK/odDkE I59/0xw9xNVl9qQuK4r7WLmoMmctVXUhQcwVWbv01vRLg4OYTe4CJ/UF0hfSxi9ZLKM1L+ 0+yonq+0CEl4lPvKzK5NWubyQ7AmrO4= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-624--U_Tu21sNZ25nrmnhXW-xQ-1; Thu, 11 Aug 2022 12:13:38 -0400 X-MC-Unique: -U_Tu21sNZ25nrmnhXW-xQ-1 Received: by mail-il1-f198.google.com with SMTP id o5-20020a056e02102500b002ddcc65029cso12771726ilj.8 for ; Thu, 11 Aug 2022 09:13:38 -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=m9J0o2gxjPkVRafIB7R87NmoXI0VU2ltkrT9Ru6AEjI=; b=zYBeQgjkK7AGo9k5oePvE9uFiHMJsfGbKds1N1uMhHyhXE/tYA924elXo0SLX5hS6J c1aEdCFxbpBbOtIPBkKjIJH8VcOfuxxxdmSy+ISb6hDFwfwTiwFASSnMLFfYcz0dyvTS L1KNPTgR+TMfvPeEtcX/TkgXIuhrdrb4JcglCJ2HjvP2/qIsyvro76l0g5P3vfpmzOHV 771ItcMgzYT4XMVpz3TxmW55GyNn2gi1aTMtjA4Vw13h0o6M8/wLEYFpn7eriZhBBenN d1TvVLvUGr5fYEY4QKlk/GJ1z5ojjDPmWnOc2QfdcDgci//CCXktKA0kQSuzC1FTbP12 LDBw== X-Gm-Message-State: ACgBeo1ba0UTqcwIblSnUs/S6bab1kPq83nzzHY9m6OTvRNKvYB3JDb4 /PnnG4rEOrGkd0uoXNITNqf8h+ttOmiCwZoNPUo7uDIovXFFGj5Rx9miFMmhcho3lfksyxIBLqc QbzMnZhy+EeGE2MTYMaLAS6gcU7onRN+HXFqZ5/O5dy08G/V9pryDtv/VP0uH X-Received: by 2002:a6b:c505:0:b0:67c:dcd:a5b2 with SMTP id v5-20020a6bc505000000b0067c0dcda5b2mr17930iof.37.1660234417511; Thu, 11 Aug 2022 09:13:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/bnpktdH+KIUEDaTM72sZY/jQsDJec0sJqNd+QvV0NBcU4DHXpzsUzSl7BCeITxJOQpuLrg== X-Received: by 2002:a6b:c505:0:b0:67c:dcd:a5b2 with SMTP id v5-20020a6bc505000000b0067c0dcda5b2mr17905iof.37.1660234417290; Thu, 11 Aug 2022 09:13:37 -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 t1-20020a92ca81000000b002dd1c3c5c46sm3415429ilo.73.2022.08.11.09.13.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Aug 2022 09:13:36 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Hugh Dickins , "Kirill A . Shutemov" , Alistair Popple , peterx@redhat.com, Andrea Arcangeli , Minchan Kim , Andrew Morton , David Hildenbrand , Andi Kleen , Nadav Amit , Huang Ying , Vlastimil Babka Subject: [PATCH v4 2/7] mm/swap: Comment all the ifdef in swapops.h Date: Thu, 11 Aug 2022 12:13:26 -0400 Message-Id: <20220811161331.37055-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220811161331.37055-1-peterx@redhat.com> References: <20220811161331.37055-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660234420; a=rsa-sha256; cv=none; b=nHSiupJlnHNoEdX9joIYsyQRpjd1FG5/z0NZ/AHgqfGjEC+N8o3aGT5RAYAkoKlN1Kte7/ 6RlCa0rrMF1jGXS0QYOMLcD7BudGLwX8IP3AneCEyINRiwdqTxWoxH5oHJmvPoG6qhPAfg EBbN8QWJFgg6NIGFua1NpZUCpW5nh68= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Kfxjeyuu; spf=pass (imf21.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660234420; 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=m9J0o2gxjPkVRafIB7R87NmoXI0VU2ltkrT9Ru6AEjI=; b=R2VJGgZVnhTpxF/6/unzCm5U8JZVeQ9T9AvzCE+UUPp+ROwtuTIfxg3LrTn05yaRQ5a6UB /1HwX1ZxRP/gdfOlHXz44CQ7hUz49KK23uIHuP1QbDekKgXBkXpA2aTUCdE6vYxysEc85i TQMsULAxof5LJ4oJdTWAnaQRYIEF4hE= X-Rspam-User: X-Stat-Signature: 486584suej1fuio1fhytzu8mahkhjtm9 X-Rspamd-Queue-Id: 6E3261C01B8 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Kfxjeyuu; spf=pass (imf21.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-HE-Tag: 1660234420-618622 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 Reviewed-by: Huang Ying Signed-off-by: Peter Xu Reviewed-by: Alistair Popple --- 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) {