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 BA3B1C433EF for ; Thu, 28 Apr 2022 23:21:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15A2B6B0071; Thu, 28 Apr 2022 19:21:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 109CD6B0072; Thu, 28 Apr 2022 19:21:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEC426B0073; Thu, 28 Apr 2022 19:21:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id DFA546B0071 for ; Thu, 28 Apr 2022 19:21:21 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A00692B207 for ; Thu, 28 Apr 2022 23:21:21 +0000 (UTC) X-FDA: 79407861162.23.22B6B3A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 4BD7840071 for ; Thu, 28 Apr 2022 23:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651188080; 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: in-reply-to:in-reply-to:references:references; bh=xqswPUGm4xMaE9jVSxLdGbvcJuYe5IqS6sTYH9EtSpE=; b=ZwxhrjKHBoH4VHtu9JJLhxZrw/gmxLRLeM9GH8uAVz3N00zsQNDdpGOvvHivPdK+i2LJfi isGMViFccH9EWCeWxowu3cYINCbvVSpjTJ5Hj80wKNfWwhvDpz3U5RaXmcW11AodOv2aX6 PaLLFwciaO9f+8QceXFNpxkITNKDNJs= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-eYlN6bB-P5aoCg38jZdRJQ-1; Thu, 28 Apr 2022 19:21:19 -0400 X-MC-Unique: eYlN6bB-P5aoCg38jZdRJQ-1 Received: by mail-io1-f72.google.com with SMTP id 204-20020a6b01d5000000b00657bb7a0f33so3576796iob.4 for ; Thu, 28 Apr 2022 16:21:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xqswPUGm4xMaE9jVSxLdGbvcJuYe5IqS6sTYH9EtSpE=; b=jkFo4gzVUzHCcAl4UwEUwAdM4Y9DaIhwQMhK6g5PnwxEybrtdZEeRWKzZh5+6teMpR AZVralxOfbiI+TsZ5ZRv0Cu0fgP/vkAz+x3aZqp2NwhKTwQ8nOD109pnsM45EOC8rsfr TsE0DGtj/AprWYEn06S9ajL63rRS2ADUWiI5gQAGbO5lAeEyYlOtxqZsKtIopuF6vXiM 8SM4OSMRgOuU3LQanT6fI67P9gd+pJRXpxrimRIi/cL80LtxsCSGmUMszXILGh4g/Pv3 dZgNz2OCFUFDhZOBRVDGXfnPu/hrn9troNHZHJP3s8WApi0X56yc1FsDahMRwgy/ozLf UaPQ== X-Gm-Message-State: AOAM53263fkEcteWul1RlU8F6tNAJaFcjAwRNz0G3YAhGfZrDjBPmbWD Jqx7mTiV6M4ONJwgGTrsaAwkE15DAKIvmFdzLRbJlnQzwg2LaZtBeZ3SqRMpmsl6A9EPI7XwRX4 KWUHh514GUYk= X-Received: by 2002:a92:7d08:0:b0:2c2:d72c:62bf with SMTP id y8-20020a927d08000000b002c2d72c62bfmr14875759ilc.167.1651188078923; Thu, 28 Apr 2022 16:21:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/NCm4DkIXFYd0cKfLMkzb3M9scyonL+LbCpCopDlc+2DvFtx/fRm7RyBNRPUMOIsRwwcm3A== X-Received: by 2002:a92:7d08:0:b0:2c2:d72c:62bf with SMTP id y8-20020a927d08000000b002c2d72c62bfmr14875728ilc.167.1651188078682; Thu, 28 Apr 2022 16:21:18 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id b12-20020a92dccc000000b002cde6e352f7sm91349ilr.65.2022.04.28.16.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 16:21:18 -0700 (PDT) Date: Thu, 28 Apr 2022 19:21:15 -0400 From: Peter Xu To: Zach O'Keefe Cc: Alex Shi , David Hildenbrand , David Rientjes , Matthew Wilcox , Michal Hocko , Pasha Tatashin , SeongJae Park , Song Liu , Vlastimil Babka , Yang Shi , Zi Yan , linux-mm@kvack.org, Andrea Arcangeli , Andrew Morton , Arnd Bergmann , Axel Rasmussen , Chris Kennelly , Chris Zankel , Helge Deller , Hugh Dickins , Ivan Kokshaysky , "James E.J. Bottomley" , Jens Axboe , "Kirill A. Shutemov" , Matt Turner , Max Filippov , Miaohe Lin , Minchan Kim , Patrick Xia , Pavel Begunkov , Thomas Bogendoerfer Subject: Re: [PATCH v3 04/12] mm/khugepaged: add struct collapse_result Message-ID: References: <20220426144412.742113-1-zokeefe@google.com> <20220426144412.742113-5-zokeefe@google.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Queue-Id: 4BD7840071 X-Stat-Signature: 1xinkcj5bmzy5sspmxjzc9b1ff1ia9bi X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZwxhrjKH; spf=none (imf04.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam09 X-HE-Tag: 1651188076-392605 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 Thu, Apr 28, 2022 at 02:59:44PM -0700, Zach O'Keefe wrote: > On Wed, Apr 27, 2022 at 1:47 PM Peter Xu wrote: > > > > On Tue, Apr 26, 2022 at 07:44:04AM -0700, Zach O'Keefe wrote: > > > +/* Gather information from one khugepaged_scan_[pmd|file]() request */ > > > +struct collapse_result { > > > + enum scan_result result; > > > + > > > + /* Was mmap_lock dropped during request? */ > > > + bool dropped_mmap_lock; > > > +}; > > > > IMHO this new dropped_mmap_lock makes things a bit more complicated.. > > > > To me, the old code actually is easy to read on when the lock is dropped: > > > > - For file, we always drop it > > - For anon, when khugepaged_scan_pmd() returns 1 > > > > That's fairly clear to me. > > > > Agreed - but I know when I first read the code it wasn't obvious to me > what the return value of khugepaged_scan_pmd() was saying. I thought > giving it a name ("dropped_mmap_lock") would help future readers. Yes that's a fair point. It's not that obvious to me too when I first read it, but I am just worried hiding that too deep could make it complicated in another form. Maybe we can rename "ret" in khugepaged_scan_mm_slot() to "lock_dropped", or we can comment above khugepaged_scan_pmd() explaining the retval. Or.. both? -- Peter Xu