From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34E823BB5A for ; Mon, 23 Mar 2026 03:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774235478; cv=none; b=OiRhqQAX99epQ2RxTsdz3qH/kfv1PI0ahBrcP3cM/rp7/UtrI7L0tToxI7t6qHH9lndhlquAu8UtiyLAGd0WB1s2Ix7ICIE4SpZUDwW3wMEzBzsqVewl1kaabhX/Rsf8GvyVGjXx0lJoqUZOObC/6ixoIB4N8LrOA0pV8zDQrtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774235478; c=relaxed/simple; bh=D622889m55zAsyQJ6OrGTattYrPQ10YSchZVvaUdZhM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AvbeW7T9LNYQW3Qh8tSnEX0Hh1rR6vhgyGKM6dy+CWseQAUSWZrxqCylNT81VzV+Vy6MGSfUnGMt/SFPpTwJQQNctNY6TkQecuAKrjfFcWsk+eq6+xpDQeu7pv5bXPZhwkkFKKT6Sin8gn6w65468bMta0agfJDLUYHCRPJpNdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Nj/gU9Z9; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Nj/gU9Z9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774235476; 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=EisQwFemUONm3eFuD9fzaWUikQLN9S4IonXmw2NBtMs=; b=Nj/gU9Z9L07UD2bDAVnAh+tKEC/Y1Ony9+pUq0QVXmJrxsxoIjdYxsqfOsg71kWeiROhpt pCp6yI51PjFjMcAdwfOv5ATeziaNCefRfF10BKynTekUZUPsBgyQcAba/xqqpEWdd+eEYa kK/WtFPC5+W3k9YfEIA4ScWlYa8MQL8= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-IGVfM-gtOxu5FC31Js5uWQ-1; Sun, 22 Mar 2026 23:11:12 -0400 X-MC-Unique: IGVfM-gtOxu5FC31Js5uWQ-1 X-Mimecast-MFC-AGG-ID: IGVfM-gtOxu5FC31Js5uWQ_1774235470 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B2423195604F; Mon, 23 Mar 2026 03:11:09 +0000 (UTC) Received: from gmail.com (unknown [10.72.112.175]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 54AD71955D71; Mon, 23 Mar 2026 03:10:58 +0000 (UTC) Date: Mon, 23 Mar 2026 11:10:54 +0800 From: Chunyu Hu To: "David Hildenbrand (Arm)" Cc: akpm@linux-foundation.org, shuah@kernel.org, linux-mm@kvack.org, ljs@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev Subject: Re: [PATCH v4 3/5] selftests/mm: move write_file helper to vm_util Message-ID: References: <20260319160656.1480279-1-chuhu@redhat.com> <20260319160656.1480279-4-chuhu@redhat.com> <78352e6f-fa40-41ee-b044-62f682f3ca43@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78352e6f-fa40-41ee-b044-62f682f3ca43@kernel.org> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On Thu, Mar 19, 2026 at 10:48:38PM +0100, David Hildenbrand (Arm) wrote: > > > + > > +void write_file(const char *path, const char *buf, size_t buflen) > > +{ > > + int fd; > > + ssize_t numwritten; > > + > > + fd = open(path, O_WRONLY); > > + if (fd == -1) > > + ksft_exit_fail_msg("%s open failed: %s\n", path, strerror(errno)); > > + > > + numwritten = write(fd, buf, buflen - 1); > > + close(fd); > > + if (numwritten < 1) > > + ksft_exit_fail_msg("Write failed\n"); > I guess we could indeed test here easily for > > if (numwritten != buflen - 1) Looks like you are right. AI provided other questions on this helper, maybe I can append a patch in the series to do such robust improvement. > > But then, we don't really expect only partial writes to succeed here. > > Acked-by: David Hildenbrand (Arm) > > -- > Cheers, > > David >