Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13291344rwd; Fri, 23 Jun 2023 20:14:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7H26EnzICdqVI/Pv3ZMCuNxnR8KXEZ703enHe3TqpzG7eojW7c0R7T8wTmSkZTzJc03/kB X-Received: by 2002:a05:6a20:8f15:b0:121:4ae4:ee2e with SMTP id b21-20020a056a208f1500b001214ae4ee2emr22687521pzk.34.1687576477372; Fri, 23 Jun 2023 20:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687576477; cv=none; d=google.com; s=arc-20160816; b=kBsbL1qR3lDiXfbf0i05zjaOnk/8beBsuO5sJgtoTLKm1uusZHa1G0z+Kq4KglIAak 1Yr348grhNKpQrBhX5foZuvarHiyQS+DPf+hlTL6cWKFaRhWWa2w//1YmZOtTTYu5lcj w0mwSYYn45BGxk0vLeJGvUixIepeSON6rs5kngCqGg8XMsc+otgGNu9fRTkjBhZJnzjX v53rTDbsSBm55La0HQOlk1Bnzeq9u5clcggH1a1vlyeh25wkkAL5FXGY9EpIyBufOVbI O0FDNn0imuCBcE1iP9SQrAhscSAVhTwl2hE/UMFxuBYKzJiVdZsUXysVOJD/AhJSyBXs FRug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=11YyvRRAb5IUX+NMds870r+K11ScAeUGmh7sZi++E+8=; fh=oGJbUunR2VuEHx4rjVweD+vuhw3fqN4UqOwJ6B0J1Lk=; b=eJHPvbsD5Og25AVDncfcXFHCR73vo8ORy1B8EwxgMunIrh3b5PSDz2VhyUb3wSAFWY GWc19vaxOnUbyO9hEE5z9kaNX+EdKGXII5/oKe0JkuN45I3X1hOnQlEwFyTaxNZJsmNb KjTrz14fY3JYvTFgCLYz6fZhlYRZi+3VYZQlywm0WyzQqHOrWDnL0CatZbXruJQtjotx zDHwxSEy4Uiq7LY6G2jiB++WNPHCR6Hr2V+mX3fcGT51GduSRB6zTZ1JZRNk0+DCIe+q S72RzVOSbbG8QPmSFbDUNdsDX0YAK1ogAUVDrpgt9TPNiy3LxG1cXtLZX3TEvh8Lg73l AKJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cPnU1I2S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f38-20020a631f26000000b0053f2fc4379csi668265pgf.391.2023.06.23.20.14.24; Fri, 23 Jun 2023 20:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cPnU1I2S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbjFXC3Y (ORCPT + 99 others); Fri, 23 Jun 2023 22:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjFXC3X (ORCPT ); Fri, 23 Jun 2023 22:29:23 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40468126 for ; Fri, 23 Jun 2023 19:29:22 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b7d4b99a21so3538195ad.0 for ; Fri, 23 Jun 2023 19:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687573761; x=1690165761; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=11YyvRRAb5IUX+NMds870r+K11ScAeUGmh7sZi++E+8=; b=cPnU1I2S7CS0GBUJSTTWf2V3U4gplDBnYXRmSxMs0isGKgs+cZSVgES/5dxAbzmguc AeoYHPTjHl9KMLC2xtKpfnDBkRy/qpub3z9s2inBFV4d4k5+g+cwsGRqSL7ViflLC7sH eJ98cEFVhYI22uNfeGYFyYVnfrOwjmahdDUiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687573761; x=1690165761; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=11YyvRRAb5IUX+NMds870r+K11ScAeUGmh7sZi++E+8=; b=dxcr23cjIsUumHHRCmXQ5j4CJP0hzji5pTS7D0Gld/Mf3qO9sJO4U+wyuyrLn+91/t jqnpUeqfFP2bV6TOgJWy8IjIiFYemfqIlJEYAvg/zWpphgupEIAC+gWwrY8V6YkS/qRN CCQoyd/+VJV8AfXdZOAswAhhk+Ho5pi84G0+6HXePQ1KbO95fgjFhMEGQwdPBkTdnCnG G7lYz8RS2h8QQ42TBFCq+d2a6AlKE3gftMzQkeb0pt1irteWHC3qhiXYJ55YEgYuQUza GKa0GFC4a5/CX1dY67Mu2HH2Ig5PPjdsNFxdck8z/YYt3m8VsLFXpvflEYfkTC1F1NOb BkfQ== X-Gm-Message-State: AC+VfDxJDBQYfFjvAyAeesufRJde9X1OBDOb80RjesUe6DFCkV5tkxMJ mNF1yajy3/tovQ3otQstu7qZqreCH0gFXCDrUFU= X-Received: by 2002:a17:902:c944:b0:1b2:1a79:147d with SMTP id i4-20020a170902c94400b001b21a79147dmr1247425pla.2.1687573761547; Fri, 23 Jun 2023 19:29:21 -0700 (PDT) Received: from google.com (KD124209188001.ppp-bb.dion.ne.jp. [124.209.188.1]) by smtp.gmail.com with ESMTPSA id i9-20020a17090332c900b00192aa53a7d5sm226294plr.8.2023.06.23.19.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 19:29:21 -0700 (PDT) Date: Sat, 24 Jun 2023 11:29:17 +0900 From: Sergey Senozhatsky To: Alexey Romanov Cc: Sergey Senozhatsky , Minchan Kim , Andrew Morton , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] zsmalloc: do not scan for allocated objects in empty zspage Message-ID: <20230624022917.GF2934656@google.com> References: <20230623044016.366793-1-senozhatsky@chromium.org> <20230623044016.366793-2-senozhatsky@chromium.org> <20230623104917.2n6vcxvhvlwmjm2m@cab-wsm-0029881> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230623104917.2n6vcxvhvlwmjm2m@cab-wsm-0029881> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (23/06/23 10:49), Alexey Romanov wrote: > > +static bool zspage_empty(struct zspage *zspage) > > +{ > > + return get_zspage_inuse(zspage) == 0; > > +} > > + > > /** > > * zs_lookup_class_index() - Returns index of the zsmalloc &size_class > > * that hold objects of the provided size. > > @@ -1625,6 +1630,10 @@ static void migrate_zspage(struct zs_pool *pool, struct size_class *class, > > obj_idx++; > > record_obj(handle, free_obj); > > obj_free(class->size, used_obj); > > + > > + /* Stop if there are no more objects to migrate */ > > + if (zspage_empty(get_zspage(s_page))) > > + break; > > } > > > > /* Remember last position in this iteration */ > > -- > > 2.41.0.162.gfafddb0af9-goog > > > > I think we can add similar check in zs_reclaim_page() function. > There we also scan zspage to find the allocated object. LRU was moved to zswap, so zs_reclaim_page() doesn't exist any longer (in linux-next).