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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFBA7C27C40 for ; Thu, 24 Aug 2023 02:20:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 234D128003B; Wed, 23 Aug 2023 22:20:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF82280033; Wed, 23 Aug 2023 22:20:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AD9E28003B; Wed, 23 Aug 2023 22:20:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EB728280033 for ; Wed, 23 Aug 2023 22:20:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B1C21C017B for ; Thu, 24 Aug 2023 02:20:26 +0000 (UTC) X-FDA: 81157394052.28.C2C02FD Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by imf16.hostedemail.com (Postfix) with ESMTP id A2285180006 for ; Thu, 24 Aug 2023 02:20:17 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf16.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.111 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692843625; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=biJyWymsUwH56jUE0VnIDPgfNz0MGEUBH7qQfneVsI8=; b=YuZldMBtk/2rQC6GjIA7jPM6X9ng2K0FXsvrqeXqhbnZE3GoNhprZoqFnzG6FabJalWJ4f d4ve67KwttvAMY2jcz74L9MCAdMTzdQrOXF+1PHDEkgkwwPUJW+gULgkkOd8K4iV1db0CG WDUVRR8mvzswLdDz1axrNFa8TSV1ipc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf16.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.111 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692843625; a=rsa-sha256; cv=none; b=m3fF0K+j6yUnobZc5na9MZBNxcYCLHsEPsDn4tPOgLukXvKLols6iaNANNwhvwgL/g+WlO nyp3xpsN6U4WgADdGhyEk9x9eOI9y+Up+GtMgcj9L4pfvJyc9AhtBfjjaduP4Ty96Hxo/B tTG16riHcvbFZLu77m4vBL5ZPQu/kJo= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VqS.n53_1692843601; Received: from 30.97.48.68(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VqS.n53_1692843601) by smtp.aliyun-inc.com; Thu, 24 Aug 2023 10:20:01 +0800 Message-ID: Date: Thu, 24 Aug 2023 10:20:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 6/9] mm/compaction: rename is_via_compact_memory to compaction_with_allocation_order To: Kemeng Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mgorman@techsingularity.net, david@redhat.com References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> <20230805110711.2975149-7-shikemeng@huaweicloud.com> <111c3142-e20b-3e3c-f107-cbb64a16c2b0@linux.alibaba.com> <1b4fd28b-96e6-ce58-3752-759a8539c6cc@huaweicloud.com> From: Baolin Wang In-Reply-To: <1b4fd28b-96e6-ce58-3752-759a8539c6cc@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A2285180006 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: cmc6f7r8f4sxq71p35mcwhaimg1sfzoo X-HE-Tag: 1692843617-764770 X-HE-Meta: U2FsdGVkX1+99ALq4BXcK3Za91laiK6C4YW/ZmZqOz55ZrxPoqTckEBjRfPRhs16tBtq3ex7cEMxsJGUsvd/uK/g2VgLw/j1b/pVj2mBwTpac+s2AJDDvE1MXGQA2pbTD/aFkRGJqsE75ZLxojDjVYrFJsBbLkHeQjbA7U9CYripo2biBZgGkqXJh8y6za774p/UhYCPQlRK4xKePw4LCWE5haMcryT7IU8OxR8ryUuW8LHUSmy5uKpewutAp2wVECnMzyYPdtaYN4IsjfQ59cspQBefQ3jHQj3g5DpFXTRvNZnj0U8BrkBZnTv+DIhJFI0+z0B3DhopkQlG/AFHC37sVLIVsje77nOsyC1T4swg0xcwHSotMeuMyDPL6ndFQS/apxy7C0LpGnskpHpAonpe9q+WyScQkuqI8Cc3SSFT2j+/hYqwd5X+Rw8QFiVaUc8lAgCz3K4fZGWW6B3ebCbmG7LNuSsd5cb1UUdKN2pKiB/tMBnCpaIdUjBoD2OnBFcpma//1WYAE5pA5/f7Qvl0YMR0wPgnnM5o97wS6Lb37UnKmQFI7LEuwO0ikeOSAuTQvFWQ2euCoEcoy/0E9S6+Mg4sn+93YWjjLhom83woQ5e2RtVlL3KWNOjEfeYUxUjPjiWrNelQEyrszy9eLixOWqDaM/DRpl2Pq0jqMZAg0aGj7EgB18JsuJ+Xs8hNBmBUIdHChJYGhgYHrzTSg92D64kflMwE87YMou8I4YrQXpi7eeCrIJLDkk8deImlAw/vmHBgBpqLDNSQeEPPOMhBiyMxVGBddbs/ruAspvIxHPtGQlWNkdW6B3mLGOiLtEz6+EtK5vLK37YLnT7oJKgACAegMUehuK3TwDGOPojQGvfFCqtQsS1kRgvKWN5xejE9eJ1IoFsEM9WMxpiaOo1qbE/l6JLlAwn5vOQdX8OU09ivshOAbBg8VN6FvZQBom9OyQXqBMbhtoQUqfa PPeq52Cf yMX8GEWXtjHoCrBQv1EbGssfcP+SdvE6fEjmtYe5fRcnncJ/hOBS3FP2aVHz034O9Nd4YEH+wt3AJh95Y54fgsU2CsPglm3F9SUhBICD/uk2FutF/wvj5KRcN/ngiYZghoAgu0zYL9ceGGfMbbERVFI9tH42MzUR2MORAN/vurBlaK5SBKB4ZnZG/lkq3QwSnwK1a 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: On 8/22/2023 9:51 AM, Kemeng Shi wrote: > > > on 8/19/2023 8:14 PM, Baolin Wang wrote: >> >> >> On 8/15/2023 8:04 PM, Kemeng Shi wrote: >>> >>> >>> on 8/15/2023 4:58 PM, Baolin Wang wrote: >>>> >>>> >>>> On 8/5/2023 7:07 PM, Kemeng Shi wrote: >>>>> We have order = -1 via proactive compaction, the is_via_compact_memory is >>>>> not proper name anymore. >>>>> As cc->order informs the compaction to satisfy a allocation with that >>>>> order, so rename it to compaction_with_allocation_order. >>>>> >>>>> Signed-off-by: Kemeng Shi >>>>> --- >>>>>    mm/compaction.c | 11 +++++------ >>>>>    1 file changed, 5 insertions(+), 6 deletions(-) >>>>> >>>>> diff --git a/mm/compaction.c b/mm/compaction.c >>>>> index d8416d3dd445..b5a699ed526b 100644 >>>>> --- a/mm/compaction.c >>>>> +++ b/mm/compaction.c >>>>> @@ -2055,12 +2055,11 @@ static isolate_migrate_t isolate_migratepages(struct compact_control *cc) >>>>>    } >>>>>      /* >>>>> - * order == -1 is expected when compacting via >>>>> - * /proc/sys/vm/compact_memory >>>>> + * compact to satisfy allocation with target order >>>>>     */ >>>>> -static inline bool is_via_compact_memory(int order) >>>>> +static inline bool compaction_with_allocation_order(int order) >>>> >>>> I know naming is hard, but this name is not good enough that can show the compaction mode. But the original one could. >>>> >>> Yes, I agree with this, but name and comment of is_via_compact_memory may >>> mislead reader that order == -1 is equivalent to compaction from >>> /proc/sys/vm/compact_memory. >>> Actually, we have several approaches to trigger compaction with order == -1: >>> 1. via /proc/sys/vm/compact_memory >>> 2. via /sys/devices/system/node/nodex/compact >>> 3. via proactive compact >> >> They can all be called proactive compaction. > I have considered rename to is_proactive_compaction. But "proactive compaction" > in comments of compaction.c mostly implies to compaction triggerred from > /proc/sys/vm/compaction_proactiveness. So "proactive compaction" itself looks > ambiguous... >> >>> >>> Instead of indicate compaction is tirggerred by compact_memocy or anything, >>> order == -1 implies if compaction is triggerrred to meet allocation with high >>> order and we will stop compaction if allocation with target order will success. >> >> IMO, the is_via_compact_memory() function helps people better distinguish the compaction logic we have under direct compaction or kcompactd compaction, while proactive compaction does not concern itself with these details. But compaction_with_allocation_order() will make me just wonder why we should compare with -1. So I don't think this patch is worth it, but as you said above, we can add more comments to make it more clear. >> > Sure, no insistant on this. > Is it looks good to you just change comment of is_via_compact_memory to: > We need do compaction proactively with order == -1 > order == -1 is expected for proactive compaction via: > 1. via /proc/sys/vm/compact_memory > 2. via /sys/devices/system/node/nodex/compact > 3. /proc/sys/vm/compaction_proactiveness Look good to me. Thanks. > >>>>>    { >>>>> -    return order == -1; >>>>> +    return order != -1; >>>>>    } >>>>>      /* >>>>> @@ -2200,7 +2199,7 @@ static enum compact_result __compact_finished(struct compact_control *cc) >>>>>            goto out; >>>>>        } >>>>>    -    if (is_via_compact_memory(cc->order)) >>>>> +    if (!compaction_with_allocation_order(cc->order)) >>>>>            return COMPACT_CONTINUE; >>>>>          /* >>>>> @@ -2390,7 +2389,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) >>>>>          cc->migratetype = gfp_migratetype(cc->gfp_mask); >>>>>    -    if (!is_via_compact_memory(cc->order)) { >>>>> +    if (compaction_with_allocation_order(cc->order)) { >>>>>            unsigned long watermark; >>>>>              /* Allocation can already succeed, nothing to do */ >>>> >> >>