Received: by 10.223.185.116 with SMTP id b49csp6540450wrg; Wed, 28 Feb 2018 11:09:58 -0800 (PST) X-Google-Smtp-Source: AH8x226hc6Lo/Pf/H0JhcdxKrlMjhcLlywcpdEEpMRLODEPSyuBzlcdGS8OpVgTQXxY5YpQ4DZv/ X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr18864259plt.434.1519844998584; Wed, 28 Feb 2018 11:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519844998; cv=none; d=google.com; s=arc-20160816; b=pUnivYDvF7e1SzJm0ZdduYOPoygsJWUXl0qtphHjCb8pAX3VEHvyC6DwtKqd0GM+h/ 2LhABNOJNFLk95K+rNeQHkAcozKCBZ/dJ8rj5Dnc5Oe2tjJEaAvNgZ4W3Dgje6sqFNJX WFXLYXgrWexGahnm31XKaAvazASiyphQOE3GtzLXdZQ+Q1YJmvueRpyhz+PCkY2y+ZAn zsfbWwfgXL9xGfKiZIqIxslfS/BEz5R3JS8QsPuwiJRlTMRbhSPov0WahqdkfTHaRlYb +rGiJY32vkrApJpyOOvADwVCEJhXH4rs0VkU96o/ueKJ+U/M8wRSTJh3lVmV6sKICTXz En5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=RZhrmAzauIAWJLn62NV4E8iE5UU79DJ+PaKEWMwjXWc=; b=VXNKAof1Yaua2W6gjtl3usz+a2uSO2uOxcEEEOelx6KySolt/tUJR6uBXse4zieYJg IBxmXovZdwcWf4k14Zl+p5PdzJ07GRMmegmMcp7rORScWUEu29yKJCYYGHarqcgBotCo tuNDpd+vTmrB0cyFO0UWZC9049zOt0CK8QiKR0Qrd5LtbqhPHIkNHumyOC8aFReTwetF hYCk1fWe6hqgKVL6Aw2LrIAmOeOlUPXYSb2dgEuSp1p3rD0SDrqJJTRjcFNL1A7kkMtE 0rrKJcdssi2VXTFgtYqTR+J+5eGw9i2Wsje95DfsmUeGLydNjAmmrQmRaO6XxpJpvxv0 p3rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15si1348030pgt.790.2018.02.28.11.09.42; Wed, 28 Feb 2018 11:09:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933281AbeB1TI0 (ORCPT + 99 others); Wed, 28 Feb 2018 14:08:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:42328 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932716AbeB1TIX (ORCPT ); Wed, 28 Feb 2018 14:08:23 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DC9DAADBF; Wed, 28 Feb 2018 19:08:21 +0000 (UTC) Date: Wed, 28 Feb 2018 19:08:21 +0000 From: "Luis R. Rodriguez" To: Vratislav Bendel Cc: linux-xfs@vger.kernel.org, "Darrick J . Wong" , Brian Foster , linux-kernel@vger.kernel.org Subject: Re: [PATCH] xfs: Correctly invert xfs_buftarg LRU isolation logic Message-ID: <20180228190821.GA14201@wotan.suse.de> References: <20180228154951.31714-1-vbendel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180228154951.31714-1-vbendel@redhat.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 28, 2018 at 04:49:51PM +0100, Vratislav Bendel wrote: > The function xfs_buftarg_isolate() used by xfs buffer schrinkers > to determine whether a buffer should be isolated and disposed > from LRU list, has inverted logic. > > Excerpt from xfs_buftarg_isolate(): > /* > * Decrement the b_lru_ref count unless the value is already > * zero. If the value is already zero, we need to reclaim the > * buffer, otherwise it gets another trip through the LRU. > */ > if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) { > spin_unlock(&bp->b_lock); > return LRU_ROTATE; > } > > However, as per documentation, atomic_add_unless() returns _zero_ > if the atomic value was originally equal to the specified *unsless* value. > > Ultimately causing a xfs_buffer with ->b_lru_ref == 0, to take another > trip around LRU, while isolating buffers with non-zero b_lru_ref. > > Signed-off-by: Vratislav Bendel > CC: Brian Foster Can you add a respective Fixes: tag? Also what effects are observed by the user when this happens on the kernel log? Luis