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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 96322C4332D for ; Fri, 20 Mar 2020 07:34:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2DC7C2051A for ; Fri, 20 Mar 2020 07:34:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d2uQtdZO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DC7C2051A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C67D36B0006; Fri, 20 Mar 2020 03:34:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C17316B0007; Fri, 20 Mar 2020 03:34:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B54EC6B0008; Fri, 20 Mar 2020 03:34:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 9E4B26B0006 for ; Fri, 20 Mar 2020 03:34:55 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 60E1A1F06 for ; Fri, 20 Mar 2020 07:34:55 +0000 (UTC) X-FDA: 76614928950.07.tray39_65275f5feb730 X-HE-Tag: tray39_65275f5feb730 X-Filterd-Recvd-Size: 3364 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 07:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584689694; 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=2n370xydiczRS5IN63oD7W/KED5NhlFBZNR/T+WrSS0=; b=d2uQtdZOMp3LwBiqitxyiBRQOo1exSV9S2OCDDzpRp3+Jq5t10GScwOEJNZ7qII1vH128l 56PA6qpjHhUp3PO9uxDwGjaxgoUjoNCs3QWd2pvFJZUiYeiXNQjyHhZo7L9QjWorH84smQ 9uVndaLZ3/nLCHNF6FygcsJ6xiEUSAk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-fImWrN26MgyPjifrA45NsA-1; Fri, 20 Mar 2020 03:34:52 -0400 X-MC-Unique: fImWrN26MgyPjifrA45NsA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43DE0800D53; Fri, 20 Mar 2020 07:34:51 +0000 (UTC) Received: from localhost (ovpn-13-97.pek2.redhat.com [10.72.13.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85AC791290; Fri, 20 Mar 2020 07:34:49 +0000 (UTC) Date: Fri, 20 Mar 2020 15:34:47 +0800 From: Baoquan He To: qiwuchen55@gmail.com, Michal Hocko Cc: akpm@linux-foundation.org, linux-mm@kvack.org, chenqiwu Subject: Re: [PATCH] mm/vmscan: fix incorrect return type for cgroup_reclaim() Message-ID: <20200320073447.GA3039@MiWiFi-R3L-srv> References: <1584633026-26288-1-git-send-email-qiwuchen55@gmail.com> <20200319160707.GG20800@dhcp22.suse.cz> MIME-Version: 1.0 In-Reply-To: <20200319160707.GG20800@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 03/19/20 at 05:07pm, Michal Hocko wrote: > On Thu 19-03-20 23:50:26, qiwuchen55@gmail.com wrote: > > From: chenqiwu > >=20 > > The return type of cgroup_reclaim() is bool, but the correct type > > should be struct mem_cgroup pointer. As a result, cgroup_reclaim() > > can be used to wrap sc->target_mem_cgroup in vmscan code. >=20 > Why is this an improvement? While we can hide the scan_control > dereference I am not seeing why this would be so much better. > Quite worse TBH because cgroup_reclaim is a predicate while you make it > return an object. This might be highly subjective thing, though. >=20 > Does the patch result in a better code generation at least. Because > without any obvious improvement I am not sure this is worth inclusion. I tend to agree with Michal. The returned bool looks good. If you really care about the internal conversion, maybe a slight change as below? static struct mem_cgroup *cgroup_reclaim(struct scan_control *sc) { =09return !!sc->target_mem_cgroup; }