From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB71C388F7 for ; Mon, 26 Oct 2020 03:03:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1675C2076A for ; Mon, 26 Oct 2020 03:03:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1675C2076A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 342AD6B0068; Sun, 25 Oct 2020 23:03:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F2EE6B006C; Sun, 25 Oct 2020 23:03:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2A46B006E; Sun, 25 Oct 2020 23:03:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id E79246B0068 for ; Sun, 25 Oct 2020 23:03:17 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7F04E3625 for ; Mon, 26 Oct 2020 03:03:17 +0000 (UTC) X-FDA: 77412580434.11.spot19_22154c627270 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 6151C180F8B80 for ; Mon, 26 Oct 2020 03:03:17 +0000 (UTC) X-HE-Tag: spot19_22154c627270 X-Filterd-Recvd-Size: 2374 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 26 Oct 2020 03:03:16 +0000 (UTC) Received: from dggeme753-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4CKKQq5QByzVh99; Mon, 26 Oct 2020 11:03:15 +0800 (CST) Received: from dggeme753-chm.china.huawei.com (10.3.19.99) by dggeme753-chm.china.huawei.com (10.3.19.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Mon, 26 Oct 2020 11:03:10 +0800 Received: from dggeme753-chm.china.huawei.com ([10.7.64.70]) by dggeme753-chm.china.huawei.com ([10.7.64.70]) with mapi id 15.01.1913.007; Mon, 26 Oct 2020 11:03:10 +0800 From: linmiaohe To: Andrew Morton CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Hugh Dickins Subject: Re: [PATCH] mm: swap: Use memset to fill the swap_map with SWAP_HAS_CACHE Thread-Topic: [PATCH] mm: swap: Use memset to fill the swap_map with SWAP_HAS_CACHE Thread-Index: AdarQpX2ZZ5fV9PCQBCbgX9M50USaQ== Date: Mon, 26 Oct 2020 03:03:10 +0000 Message-ID: <16636ab4ebb746b4ba0a14eec8225cbc@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.177.91] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected 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: Andrew Morton wrote: > On Mon, 21 Sep 2020 08:22:24 -0400 Miaohe Lin wrot= e: > >> We could use helper memset to fill the swap_map with SWAP_HAS_CACHE=20 >> instead of a direct loop here to simplify the code. Also we can remove=20 >> the local variable i and map this way. >> *slot =3D swp_entry(si->type, offset); > >I suppose so. But it does assume that the ->swapmap array has the type ch= ar. If we ever change that, breakage will ensue. > The origin code already assumes that the ->swap_map array has the type char= . So, this change is ok. ;) And if we change the type of ->swap_map, each place uses the swap_map shoul= d be fixed accordingly.;( Many thanks.